用推特原生的sdk做ios的twitter第三方登陆,报错如下:
[TwitterKit] did encounter error with message "Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "<?xml version="1.0" encoding="UTF-8"?><errors><error code="415">Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings</error></errors>" UserInfo={NSLocalizedDescription=<?xml version="1.0" encoding="UTF-8"?><errors><error code="415">Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings</error></errors>}
但是我已经按照官方的文档配置了啊,
附赠官方链接:https://github.com/twitter/twitter-kit-ios/wiki/Log-In-With-Twitter
英语不好的可以看这个:
https://blog.csdn.net/iOSCircleAndCircle/article/details/75115132
(这个demo下载下来也会报我说的那个错误)
这种时候当然只能谷歌和百度了,
然后百度到了,这个https://blog.csdn.net/lizebin_bin/article/details/80707733
“最后在某个issue中找到了一个Callback URL,据说是Twitter官方使用的url,把它填入到我们的应用后台白名单就ok了
对就是它:twittersdk:// ” 不过这是针对Android的
那么ios也应该差不多,
然后谷歌到了这两个:
https://github.com/GoldenOwlAsia/react-native-twitter-signin/issues/92
https://twittercommunity.com/t/ios-twitter-login-error-code-415/107775
就是要在https://apps.twitter.com里,Callback URLs一栏中添加上twitterkit-CONSUMERKEY://
(CONSUMERKEY记得替换)
总结一下就是这位网友所提的方案
To Fix this issue do as below:
[Mandatory]
Add CallbackURL into the dashboard as below format:
For iOS:
twitterkit-CONSUMERKEY://
For Android:
twittersdk://
Help Link: https://twittercommunity.com/t/ios-twitter-login-error-code-415/107775
[ Note: Please replace your consumer key in place of words "CONSUMERKEY" in above format]