Hos*_*ein 5 api instagram two-factor-authentication instagram-api
我在应用程序中使用Instagram API进行身份验证。该API正常运行,但当用户使用两因素身份验证时,redirect_uri不起作用,并且用户重定向到Instagram主页,而不是正确的URL(我的应用程序登录URL)。我不知道该如何处理,找不到任何好的答案。请帮我
注意:这种情况是首次发生,并且在正确登录的浏览器用户中可以使用Instagram的登录会话时。
不确定这是否仍然有帮助。但我在 React Native WebView 组件上实现了以下内容,并解决了 Instagram 的明显失误。
注意 -更可靠的解决方案是 Instagram 实际解决该错误。
作为 WebView 上的 props:
source={{ uri: this.state.uri }}
onNavigationStateChange={this._onNavigationStateChange}
Run Code Online (Sandbox Code Playgroud)
处理方法:
_onNavigationStateChange(webViewState){
const url = webViewState.url || ''
if(url.includes('challenge')){
this.setState({challenged: true})
}
if(url === 'https://www.instagram.com/' && this.state.challenged){
this.setState({
uri: `${URI}&indifferent_query_param=${(new Date).getTime()}`
})
}
}
Run Code Online (Sandbox Code Playgroud)
该处理方法强制重新渲染 WebView 并将用户发送到“授权”页面。根据您的实施平台,您可以应用与上述类似的内容。
| 归档时间: |
|
| 查看次数: |
452 次 |
| 最近记录: |