使用 Steam OpenId(oidc-client-js) 登录

Login with Steam OpenId(oidc-client-js)

我已经用 google 完成了客户端身份验证时的身份验证,收到 token_id,将其发送到服务器,服务器检索该 token_id 的客户帐户信息库。这很容易,因为它是 documented. Now I try to do with Steam but literally I have 4 rows about OpenID in steam docs. I start using an openID browser lib oidc-client-js,但 Steam 文档对我没有帮助。 openID 库需要这些字段:

Steam 文档仅提供提供商、密钥和域名,我真的不知道从哪里开始。

Just download an OpenID library for your language and platform of choice and use http://steamcommunity.com/openid as the provider. The returned Claimed ID will contain the user's 64-bit SteamID. The Claimed ID format is: http://steamcommunity.com/openid/id/

我遇到 CORS Header 问题,因为我使用本地主机而不是安全连接,我想我需要在 oidc-client-js:

中配置其他字段

如有任何帮助,我们将不胜感激

tl;dr:Steam 不是 OpenID Connect 提供商

我遇到了完全相同的问题。

我尝试 运行 chrome 禁用 CORS 以查看它是否有效,我从 oidc-client 收到错误消息:

SyntaxError: Unexpected token < in JSON at position 0  
    at JSON.parse (<anonymous>)  
    at XMLHttpRequest.s.onload (oidc-client.min.js?3809:1)

这很容易理解,因为 https://steamcommunity.com/openid/.well-known/openid-configuration 看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">
<XRD>
    <Service priority="0">
        <Type>http://specs.openid.net/auth/2.0/server</Type>        
        <URI>https://steamcommunity.com/openid/login</URI>
    </Service>
</XRD>
</xrds:XRDS>

这显然不是JSON。

Type balise 中的 URL 重定向到 http://openid.net/specs/openid-authentication-2_0.html, which can be found in the obsolete section of the OpenID specifications page

此外,您可以在 OpenID Connect Discovery specification page 中找到

OpenID Providers supporting Discovery MUST make a JSON document available at the path formed by concatenating the string /.well-known/openid-configuration to the Issuer.

证实 Steam OpenID 端点的 .wellknown/openid-configuration 文件不是为 OpenID Connect.

制作的

所以我认为可以肯定地说 Steam 坚持 OpenID 2.0 而不是 OpenID Connect 提供商。

现在我必须寻找一个 OpenID 2.0 js 客户端,或者切换到 Google 登录。

您可以使用我的 Steam OpenID Connect 提供商: https://github.com/ImperialPlugins/steam-openid-connect-provider

它也可以在 DockerHub 上作为 docker 图像使用: https://hub.docker.com/r/imperialplugins/steam-openid-connect-provider

这允许您将 OpenID Connect 与 Steam 结合使用。