使用我们自己的Authservice对本机OAuth2身份验证进行反应

时间:2017-03-15 15:21:33

标签: android react-native oauth-2.0

我们有一个遵循OAuth2协议的Authservice。网址如下:

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]);
}

我不知道我必须添加到我的重定向网址以重定向到我的应用。

1 个答案:

答案 0 :(得分:0)

我解决了它:

<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>
  1. 必须将其添加到Manifest.xml
  2. 可在架构:// url路径上访问的应用程序。