admin管理员组

文章数量:1400007

I currently have a web project for a game and I want users to be able to login to share stuff, that is currently done (and neatly working) using google's firebase authentication.

But I want people to be able to be authenticated via Steam (using Oauth2)

the firebase reference/API () wasn't to helpful as I couldn't find exact (working) examples of what I need to implement and I don't have too much experience with Oauth2 or Firebase yet.

from I got my API key and that I should use "" as the provider.

And I tried using it this way:

var provider = new firebase.auth.OAuthProvider("steammunity/openid");

firebase.auth().signInWithPopup(provider).catch(function(error)
{
  console.log(error.message);
});

this is the basic function that works with all the default providers (Google, Twitter, Facebook, etc)

However I get a "provider ID not supported" in the console, and I have obviously forgotten something somewhere, but I don't really know what it is exactly (I know I should be inputting the API secret from steam somewhere) and I am not sure for where to start looking (eg. do I need to change anything in my firebase settings, ..)

It would be really helpful if someone could help me out with my problem or point to a working example that I can go through, as my googling has only led me to the official firebase references and API and those haven't really helped me so far.

I currently have a web project for a game and I want users to be able to login to share stuff, that is currently done (and neatly working) using google's firebase authentication.

But I want people to be able to be authenticated via Steam (using Oauth2)

the firebase reference/API (https://firebase.google./docs/auth/web/custom-auth) wasn't to helpful as I couldn't find exact (working) examples of what I need to implement and I don't have too much experience with Oauth2 or Firebase yet.

from http://steammunity./dev I got my API key and that I should use "http://steammunity./openid" as the provider.

And I tried using it this way:

var provider = new firebase.auth.OAuthProvider("steammunity./openid");

firebase.auth().signInWithPopup(provider).catch(function(error)
{
  console.log(error.message);
});

this is the basic function that works with all the default providers (Google, Twitter, Facebook, etc)

However I get a "provider ID not supported" in the console, and I have obviously forgotten something somewhere, but I don't really know what it is exactly (I know I should be inputting the API secret from steam somewhere) and I am not sure for where to start looking (eg. do I need to change anything in my firebase settings, ..)

It would be really helpful if someone could help me out with my problem or point to a working example that I can go through, as my googling has only led me to the official firebase references and API and those haven't really helped me so far.

Share Improve this question edited Nov 26, 2017 at 21:06 Frank van Puffelen 601k85 gold badges890 silver badges860 bronze badges asked Nov 26, 2017 at 19:08 CerbionCerbion 1091 gold badge2 silver badges10 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

firebase.auth.OAuthProvider currently only supports existing providers and has not been extended to support additional providers. You would need to use custom authentication. I just googled and found this library for authentication with Steam: https://www.npmjs./package/steam-login. You can use that to sign in with Steam and then get the Steam user ID, mint a custom token with it using Firebase Admin SDK: https://firebase.google./docs/auth/admin/create-custom-tokens using that Steam UID and then send the custom token to the client to plete sign in with signInWithCustomToken: https://firebase.google./docs/auth/web/custom-auth

You can do that with Identity Platform provided by GCP. You can find the documentation in the following link. You need to have a billing enabled Firebase project to do so.

https://cloud.google./identity-platform/docs/web/oidc

First you have to configure the new OpenID Connect provider in GCP console. Then you can simply use Firebase OAuthProvider as you usually use with other Firebase provided OAuth services.

I will not going to explain every step here because the documentation has everything you need to know.

本文标签: javascriptHow can I use Firebase custom auth with an openID providerStack Overflow