24
votes

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?

7

7 Answers

52
votes

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

28
votes

I just added on callback url field twitterkit-<api/consumer Key>://. If you have an apiKey like abc you should add twitterkit-abc://. This work for iOS, for Android just add twittersdk://.

18
votes

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]

4
votes

My solution: I hope it's useful. enter image description here

1
votes

Go to https://apps.twitter.com

Then in the "Settings" tab of your app. Fill the "Callback URLs" form.

According to this documentation i guess you just have to enter a valid URL : https://github.com/twitter/twitter-kit-ios/wiki/Installation

NOTE: Although the callback URL will not be requested by Twitter Kit in your app, it must be set to a valid URL for the app to work with the SDK.

1
votes

Hey everyone here is a simple fix that worked for me.

Go to: https://apps.twitter.com Go into the settings tab. Under Terms of Service URL uncheck the box that says: "Unable Callback Locking" Now test your app.

0
votes

Finally I found the solution for my case. Hope it'll help someone else

Put this in URL Callback field.

twittersdk://

Refer: https://github.com/twitter/twitter-kit-android/issues/135