0
我目前正在开发oo oauth实现。所以我有一个打开浏览器并要求登录信息的按钮。然后,此页面使用DeepLinking重定向到应用程序。问题是我无法使用事件侦听器从网站获取传递的数据。在React Native中进行链接
componentDidMount() {
Linking.addEventListener('url', this.handleUrl);
}
componentWillUnmount() {
Linking.removeEventListener('url', this.handleUrl);
}
handleUrl(event) {
console.log(event); //I just dont get any console output
}
openAuth() {
Linking.openURL('https://dribbble.com/oauth/authorize?client_id=MY_ID&redirect_uri=Trippple://Login&state=ungessablanism')
}
handleUrl被调用?你看到它输出未定义或XCode或Chrome中的东西?我在iOS上使用Linking做了类似的设置,并且我能够检查传递的URL,并从中解析出令牌信息。 – agmcleod
我不这么认为没有任何东西被记录到控制台。 – Dedpul
现在,在我添加this.handleUrl()之后,它会在我重新加载应用程序后返回undefined,但是应用程序不会在链接重新打开后再次返回。 – Dedpul