Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

swift - Twitter Call back URL

I am working with twitter SDK to integrate with in ios app.When i follow all the step and create the customer key and put it in my app.When I run the app it show "[TwitterKit] did encounter error with message

"Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings" UserInfo={NSLocalizedDescription=Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings"

How to resolve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had the same problem and the TwitterKit documentation is not accurate or Twitter has changed their policies. In any case, on the Twitter Apps site, the callback URL has to be set very specifically. The callback URL should be in the format:

twitterkit-{consumer/api key}://

For example:

twitterkit-128238aKjqlp123AKdasdf://

Also, this needs to be registered in your Info.plist exactly the same:

<dict>
<key>CFBundleURLSchemes</key>
<array>
    <string>twitterkit-128238aKjqlp123AKdasdf</string>
</array>
</dict>

More documentation is listed here: https://developer.twitter.com/en/docs/basics/callback_url.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...