【问题标题】:Auth0 Custom Social Connections Extension not work with Twitch?Auth0 自定义社交连接扩展不适用于 Twitch?
【发布时间】:2017-10-08 10:20:23
【问题描述】:

现在,我正在使用 React-Redux 创建 Twitch 应用程序。

我只是在使用 Auth0 时遇到了身份验证问题。

import auth0 from 'auth0-js';

export default class Auth {
    constructor() {
        this.popupTwitch = this.popupTwitch.bind(this)
    }

    auth0 = new auth0.WebAuth({
        domain: 'XXX.auth0.com',
        clientID: XXX,
        redirectUri: 'http://localhost:3000/callback',
        audience: 'https://XXX.auth0.com/userinfo',
        responseType: 'token id_token',
        scope: 'openid'
    });

    popupTwitch() {
        this.auth0.popup.authorize({
            connection: 'twitch'
        })
    }
}

当我运行此代码时,auth0 返回以下错误。

http://localhost:3000/?error=redirect_mismatch&error_description=Parameter+redirect_uri+does+not+match+registered+URI&state=XXX

我的设置截图如下。

Twitch Developer Dashboard Apps

Auth0 Custom Social Connection

提前感谢您的帮助。

【问题讨论】:

    标签: reactjs auth0 twitch


    【解决方案1】:

    您好,您需要将 twitch 回调设置为重定向到 auth0,而不是 localhost。 所需的域可以在您的 auth0 客户端的设置中找到:https://manage.auth0.com/#/clients

    希望有帮助:)

    【讨论】:

    • 我尝试更改 twitch 重定向 uri。我可以到达抽搐授权页面。 https://passport.twitch.tv/authorizations/new?client_id=xxx&login=xxx&redirect_uri=https://xxx.auth0.com/login/callback&response_type=code&scope=openid+channel_editor+channel_read&state=xxx当我点击同意时,出现401错误。
    • 看起来您在 twitch url 中使用了 auth0 范围。您需要将范围更改为 user_read 才能成功登录
    • 谢谢。我改为user_read,它重定向到回调uri,片段中带有access_token。但是当我使用这个 access_token 时,twitch 返回“invalid access_token”。这个令牌不是用于 twitch 吗?
    猜你喜欢
    • 2015-02-10
    • 1970-01-01
    • 1970-01-01
    • 2016-10-21
    • 1970-01-01
    • 2014-01-06
    • 2014-07-26
    • 1970-01-01
    • 2023-04-07
    相关资源
    最近更新 更多