iOS Twitter OAuth 1.0 在授权后返回 login/error 而不是回调 url

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

我正在尝试通过 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。据我了解,预期的行为是通过这些步骤在最后一步获得 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

相反,我目前得到的是第 2 步后的错误,根本没有重定向 url。最后一步重定向到我的网络视图上的这个登录页面。在这种情况下,我什至通过直接登录 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

我发现了这个问题,它与 WKWebview 粘贴有关,键盘粘贴文本是密码输入的两倍,因此导致 Twitter 上的身份验证失败。

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