简体   繁体   English

iOS Twitter OAuth 1.0 在授权而不是回调 url 后返回登录/错误

[英]iOS Twitter OAuth 1.0 returning login/error after authorize instead of callback url

I'm trying to use twitter's oath 1.0 via STTwitter cocoa pod to get a user access token as described here https://developer.twitter.com/en/docs/tutorials/authenticating-with-twitter-api-for-enterprise/oauth1-0a-and-user-access-tokens .我正在尝试通过 STTwitter cocoa pod 使用 twitter 的 oath 1.0 来获取用户访问令牌,如此处所述https://developer.twitter.com/en/docs/tutorials/authenticating-with-twitter-api-for-enterprise/ oauth1-0a-and-user-access-tokens I have a twitter developer app approved with a callback url configured in a similar format https://twitter.example.com .我有一个 twitter 开发者应用程序批准了一个回调 url,它以类似的格式https://twitter.example.com配置。 From what I understood the expected behaviour would be to go through these steps to get the oauth_verifier at the last step.据我了解,预期的行为将是通过这些步骤在最后一步获取oauth_verifier

1) https://api.twitter.com/oauth/authorize?oauth_callback_confirmed=true&oauth_token_secret=SOMESECRET&force_login=1&oauth_token=SOMETOKEN
2) https://api.twitter.com/oauth/authorize
3) https://twitter.example.com/?oauth_token=SOMETOKEN&oauth_verifier=SOMEVERIFIER

Instead what I'm currently getting is an error after step 2 and no redirect url back at all.相反,我目前得到的是第 2 步之后的错误,并且根本没有重定向 url。 The last step redirects to this login page on my web view.最后一步重定向到我的 web 视图上的这个登录页面。 In this case I even double checked if the user credentials were correct by logging on twitter's website directly.在这种情况下,我什至通过直接登录 twitter 的网站来仔细检查用户凭据是否正确。

1) https://api.twitter.com/oauth/authorize?oauth_callback_confirmed=true&oauth_token_secret=SOMESECRET_login=1&oauth_token=SOMETOKEN
2) https://api.twitter.com/oauth/authorize
3) https://twitter.com/login/error?username_or_email=SOMEEMAIL&redirect_after_login=https%3A%2F%2Fapi.twitter.com%2Foauth%2Fauthorize%3Foauth_token%SOMETOKEN

第2步 第 3 步

I have found the issue and it was related to WKWebview paste with keyboard paste text twice the password input, thus causing an authentication failure on twitter.我发现了这个问题,它与 WKWebview 粘贴有关,键盘粘贴文本是密码输入的两倍,因此导致 twitter 上的身份验证失败。

https://developer.apple.com/forums/thread/696525 https://developer.apple.com/forums/thread/696525

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM