首页 > 解决方案 > Discord oAuth 与本机反应

问题描述

所以在过去的一天里,我一直试图将不和谐的 oAuth 实现到一个反应原生的应用程序中,但无济于事。我尝试使用 react-native-app-auth 包,但收到null is not an object (evaluating 'RNAppAuth.authorize')代码错误

    const config = {
        clientId: '[REDACTED]',
        clientSecret: '[REDACTED]',
        redirectUrl: '[REDACTED]',
        scopes: ['identify'],
        serviceConfiguration: {
          authorizationEndpoint: 'https://discord.com/api/oauth2/authorize?client_id=[REDACTED]&redirect_uri=[REDACTED]',
          tokenEndpoint: 'https://discordapp.com/api/oauth2/token',
          revocationEndpoint: 'https://discordapp.com/api/oauth2/token/revoke'
        }
      }
    try {
        const authResult = await authorize(config)
        console.log(authResult)
    } catch (error) {
        console.log(error)
    }
}

然后我尝试了expo身份验证方法,但那个方法根本不起作用,有人可以帮我吗?任何帮助将不胜感激。使用 expo 42.0.1、react 16.13.1 和 react native 42.0.0 运行 expo proj。

标签: reactjsreact-nativeoauth-2.0

解决方案


推荐阅读