Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

AuthProvider class lacks API to retrieve provider name #8584

Open
ensonic opened this issue Oct 22, 2024 · 4 comments
Open

AuthProvider class lacks API to retrieve provider name #8584

ensonic opened this issue Oct 22, 2024 · 4 comments

Comments

@ensonic
Copy link

ensonic commented Oct 22, 2024

Operating System

Any

Environment (if applicable)

Google Chrome 130.0.6723.58 (Official Build) (64-bit)

Firebase SDK Version

10.12.0

Firebase SDK Product(s)

Auth

Project Tooling

Angular

Detailed Problem Description

I configure a custom OIDC provider following https://firebase.google.com/docs/auth/web/openid-connect#before_you_begin

In my app we have a dialog for the user to choose the login provider to use. Since there are multiple OIDC providers I'd like to use human readble labels. When I create the provider with the provider-id, I would expect an api like provider.GetName() to retrieve that name that I specified when I created the provider.

The api docs don't list such an api:
https://firebase.google.com/docs/reference/node/firebase.auth.AuthProvider

Steps and code to reproduce issue

See above.

@ensonic ensonic added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Oct 22, 2024
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@lehcar09 lehcar09 added api: auth needs-attention and removed needs-triage new A new issue that hasn't be categoirzed as question, bug or feature request labels Oct 22, 2024
@ensonic
Copy link
Author

ensonic commented Oct 23, 2024

I've dumped the provider object and it does not seem to contain the information, so it is more that just adding api for it.

@hsubox76
Copy link
Contributor

Let me know if I am misunderstanding but I'm creating an OAuthProvider as the instructions in the guide doc you linked say to do and this seems to work?

import { OAuthProvider } from 'firebase/auth';

const provider = new OAuthProvider('custom name');
console.log(provider.providerId); // "custom name"

@ensonic
Copy link
Author

ensonic commented Oct 23, 2024

providerId is e.g. oidc.my-provider´, but when creating the provider in firebase console I named it e.g. "My Provider". I'd like to access the display name to pt it on a button label. I can probably implement some reverse transform, but I won't be able to recover the original name in all cases (e.g My Super-Providerbecomesoidc.my-super-provider` and I won't know which minus was a space and which a minus).

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

5 participants