Android 使用我们自己的Authservice响应本机OAuth2身份验证

Android 使用我们自己的Authservice响应本机OAuth2身份验证,android,react-native,oauth-2.0,Android,React Native,Oauth 2.0,我们有一个遵循OAuth2协议的Authservice。url如下所示: https://auth.domaon.com/web/login?client_id=client&login_redirect_uri=%2Fweb%2Fauthorize&redirect_uri=????????&response_type=code&state=somestate 我如何使用它在我们的移动应用程序中登录我的用户 我试着把它联系起来 openAuth() {

我们有一个遵循OAuth2协议的Authservice。url如下所示:

https://auth.domaon.com/web/login?client_id=client&login_redirect_uri=%2Fweb%2Fauthorize&redirect_uri=????????&response_type=code&state=somestate
我如何使用它在我们的移动应用程序中登录我的用户

我试着把它联系起来

openAuth() {
    Linking.openURL('URL above');
}
componentDidMount() {
    Linking.addEventListener('url', this._handleURL);
}
_handleURL(event) {
    console.log(event.url);
    console.log(event.url.split('#')[1].split('=')[1].split('&')[0]);
}
我不知道我必须在重定向URL中添加什么才能重定向到我的应用程序

我解决了这个问题:

<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data android:scheme="schema"
    android:host="url" />
</intent-filter>

  • 必须将其添加到Manifest.xml
  • 应用程序可在schema://url 路径