Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Log in using Twitter #135

Open
HalyangDream opened this issue Jun 14, 2018 · 16 comments
Open

Log in using Twitter #135

HalyangDream opened this issue Jun 14, 2018 · 16 comments

Comments

@HalyangDream
Copy link

If you log in with Twitter, "Callback URL not approved for this client application.approved Callback URLs can be adjusted in your application Settings " even if the phone does not have a Twitter client installed, but I did Apps.twitter.com has filled in the Url of the Callback, and the format is correct. What should be done?

@Andrew67
Copy link

I had to dig into https://github.com/twitter/twitter-kit-android/blob/d71efe38404b5233e312f2531efbf72e5ce5d7bc/twitter-core/src/main/java/com/twitter/sdk/android/core/internal/oauth/OAuth1aService.java to find where the callback was being set.
Try setting "twittersdk://" as your callback URL in your developer settings.

@jayshildave
Copy link

Life saver @Andrew67 I am just wondering isnt it a poor implementation from twitter's side. If they want to whitelist callbacks. They should be adding their SDK's generated callback url's from their end. Instead of depending on everyone adding it. Many thanks!

@HalyangDream
Copy link
Author

@Andrew67 I want to put the "callback url" somewhere in the app. There is no specific description on the document. I hope you can tell me how to do it

@Andrew67
Copy link

@HalyangDream, I thought I wanted to put a callback URL somewhere in the app as well. You don't have to.
Just place that URL I mentioned above in the list of callback URLs on the apps.twitter.com settings for your app.
@jayshildave I agree 100%, every piece of documentation I could find for this SDK assured me I wouldn't have to worry about the callback URL.

@HalyangDream
Copy link
Author

@Andrew67 Thank you for your reply and help. I have already solved this problem. Thank you very much for your help

@yangkai3
Copy link

@Andrew67 thank you , this works for me

@jin123d
Copy link

jin123d commented Jun 15, 2018

@Andrew67 thank you

1 similar comment
@lizebinbin
Copy link

@Andrew67 thank you

@XAVlER-S
Copy link

XAVlER-S commented Jun 15, 2018

@HalyangDream @Andrew67 To close this issue, you also need to specify this callback url

twitterkit-YOUR_CONSUMER_KEY://

to make TwitterKit for iOS work.

See: #134 Problem with login with twitter web

@rahul-rahul1
Copy link

@Andrew67..i am facing same issue.

@dhabensky
Copy link

I sniffed auth request and saw callback url in headers. It started with twittersdk://callback and had parameters such as twitter sdk version and consumer key.
I tried to add it to the whitelist and got rejection duy to incorrect format.
I reread @Andrew67 answer and figured out my mistake.
I think this should be pointed explicitly:
Add EXACTLY string twittersdk:// and NOTHING MORE to make your app work again.

@rahul-rahul1
Copy link

twittersdk:// by using this ,it is working fine.

@idrisbohra
Copy link

@Andrew67 i am bumping by head for the whitelisted URLs from past 3 days and because of you only it get solved...thank you sooooo much..

@pankaj8958
Copy link

@XavierSAndroid thank-you very much this saved my day :)

@linh232323
Copy link

@Andrew67 Thanks, it works as expected

@frared358
Copy link

frared358 commented Nov 15, 2018

I am getting this Error In Failure Method While Login In android: com.twitter.sdk.android.core.TwitterAuthException: Failed to get request token

Error in Log.Console

E/Twitter: Invalid json: <?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>
           com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
               at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
               at com.twitter.sdk.android.core.models.SafeListAdapter$1.read(SafeListAdapter.java:45)
               at com.twitter.sdk.android.core.models.SafeMapAdapter$1.read(SafeMapAdapter.java:45)
               at com.google.gson.Gson.fromJson(Gson.java:887)
               at com.google.gson.Gson.fromJson(Gson.java:852)
               at com.google.gson.Gson.fromJson(Gson.java:801)
               at com.google.gson.Gson.fromJson(Gson.java:773)
               at com.twitter.sdk.android.core.TwitterApiException.parseApiError(TwitterApiException.java:110)
               at com.twitter.sdk.android.core.TwitterApiException.readApiError(TwitterApiException.java:95)
               at com.twitter.sdk.android.core.TwitterApiException.<init>(TwitterApiException.java:43)
               at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42)
               at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
               at android.os.Handler.handleCallback(Handler.java:739)
               at android.os.Handler.dispatchMessage(Handler.java:95)
               at android.os.Looper.loop(Looper.java:145)
               at android.app.ActivityThread.main(ActivityThread.java:6946)
               at java.lang.reflect.Method.invoke(Native Method)
               at java.lang.reflect.Method.invoke(Method.java:372)
               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
            Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
               at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
               at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
               at com.twitter.sdk.android.core.models.SafeListAdapter$1.read(SafeListAdapter.java:45) 
               at com.twitter.sdk.android.core.models.SafeMapAdapter$1.read(SafeMapAdapter.java:45) 
               at com.google.gson.Gson.fromJson(Gson.java:887) 
               at com.google.gson.Gson.fromJson(Gson.java:852) 
               at com.google.gson.Gson.fromJson(Gson.java:801) 
               at com.google.gson.Gson.fromJson(Gson.java:773) 
               at com.twitter.sdk.android.core.TwitterApiException.parseApiError(TwitterApiException.java:110) 
               at com.twitter.sdk.android.core.TwitterApiException.readApiError(TwitterApiException.java:95) 
               at com.twitter.sdk.android.core.TwitterApiException.<init>(TwitterApiException.java:43) 
               at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42) 
               at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68) 
               at android.os.Handler.handleCallback(Handler.java:739) 
               at android.os.Handler.dispatchMessage(Handler.java:95) 
               at android.os.Looper.loop(Looper.java:145) 
               at android.app.ActivityThread.main(ActivityThread.java:6946) 
               at java.lang.reflect.Method.invoke(Native Method) 
               at java.lang.reflect.Method.invoke(Method.java:372) 
               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) 
               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 
           Failed to get request token
           com.twitter.sdk.android.core.TwitterApiException: HTTP request failed, Status: 403
               at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42)
               at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
               at android.os.Handler.handleCallback(Handler.java:739)
               at android.os.Handler.dispatchMessage(Handler.java:95)
               at android.os.Looper.loop(Looper.java:145)
               at android.app.ActivityThread.main(ActivityThread.java:6946)
               at java.lang.reflect.Method.invoke(Native Method)
               at java.lang.reflect.Method.invoke(Method.java:372)
               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
E/Twitter: Authorization completed with an error
           com.twitter.sdk.android.core.TwitterAuthException: Failed to get request token
               at com.twitter.sdk.android.core.identity.OAuthController$1.failure(OAuthController.java:94)
               at com.twitter.sdk.android.core.internal.oauth.OAuth1aService$1.failure(OAuth1aService.java:191)
               at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42)
               at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
               at android.os.Handler.handleCallback(Handler.java:739)
               at android.os.Handler.dispatchMessage(Handler.java:95)
               at android.os.Looper.loop(Looper.java:145)
               at android.app.ActivityThread.main(ActivityThread.java:6946)
               at java.lang.reflect.Method.invoke(Native Method)
               at java.lang.reflect.Method.invoke(Method.java:372)
               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

Please Help..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests