如何通过 openID 提供程序使用 Firebase 自定义身份验证?

Cer*_*ion 3 javascript oauth-2.0 firebase steam firebase-authentication

我目前有一个游戏的网络项目,我希望用户能够登录以共享内容,目前使用谷歌的 firebase 身份验证完成(并且工作正常)。

但我希望人们能够通过 Steam 进行身份验证(使用 Oauth2)

firebase 参考/API(https://firebase.google.com/docs/auth/web/custom-auth)没有帮助,因为我找不到我需要实现的确切(工作)示例,我对 Oauth2 或 Firebase 还没有太多经验。

http://steamcommunity.com/dev我得到了我的 API 密钥,我应该使用“ http://steamcommunity.com/openid ”作为提供者。

我尝试以这种方式使用它:

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

firebase.auth().signInWithPopup(provider).catch(function(error)
{
  console.log(error.message);
});
Run Code Online (Sandbox Code Playgroud)

这是适用于所有默认提供商(Google、Twitter、Facebook 等)的基本功能

但是,我在控制台中收到了“不支持的提供商 ID”,而且我显然在某处忘记了某些内容,但我真的不知道它到底是什么(我知道我应该在某处输入来自 Steam 的 API 秘密),我是不确定从哪里开始寻找(例如,我是否需要更改 Firebase 设置中的任何内容,..)

如果有人可以帮助我解决我的问题或指出我可以完成的工作示例,那将非常有帮助,因为我的谷歌搜索只会让我找到官方的 Firebase 参考和 API,而到目前为止这些并没有真正帮助我.

boj*_*eil 5

firebase.auth.OAuthProvider目前仅支持现有提供者,尚未扩展以支持其他提供者。您将需要使用自定义身份验证。我刚刚用谷歌搜索并找到了这个用于 Steam 身份验证的库:https : //www.npmjs.com/package/steam-login。您可以使用它来登录 Steam,然后获取 Steam 用户 ID,使用 Firebase Admin SDK使用它创建自定义令牌:https ://firebase.google.com/docs/auth/admin/create-custom-tokens使用该 Steam UID,然后将自定义令牌发送到客户端以完成登录signInWithCustomTokenhttps : //firebase.google.com/docs/auth/web/custom-auth