This may be the most asked question on SO, but i am still unable to fix my problem. I have checked this, this and many others, but the problem is still there.
If twitter app is installed on user's device, everything works fine, but if its not there i get the following error message.
Invalid json: Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
com.twitter.sdk.android.core.TwitterApiException: HTTP request failed, Status: 403 at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42)
I defined https://www.google.com
as a callback URL, and following is my implementation.
//Activity Class
Twitter.initialize(this);
button.setCallback(new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> result) {
TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();
TwitterAuthToken authToken = session.getAuthToken();
String token = authToken.token;
String secret = authToken.secret;
login(session);
}
@Override
public void failure(TwitterException exception) {
Log.d("Failure", "failure");
}
});
Strings.xml
<string name="com.twitter.sdk.android.CONSUMER_KEY">---</string>
<string name="com.twitter.sdk.android.CONSUMER_SECRET">---</string>
Gradle
compile 'com.twitter.sdk.android:twitter:3.1.1'
EDIT
I have also tried twittersdk://
and twitterkit-consumer-key://
as callback Url
General troubleshootingTry clearing cache and cookies for your device's mobile browser. You can clear cache and cookies from the settings menu for your mobile browser. Check to make sure that javascript is enabled on your device.
Just open Twitter in Chrome, Safari, or another browser—use an incognito window if you're already signed in. When you visit the Twitter homepage in a desktop browser without signing in, it asks you to log in before doing anything. However, we'll show you other links that let you get around this.
Twitter supports MP4 and MOV videos with H. 264 encoding and AAC audio. It does not accept other video formats like MKV, AVI, FLV, or WebM. Also, if you export the video in a very high resolution, say 4K or 2K with a high fps, Twitter may not support it.
Refer this link here.
We need to set twittersdk:// inside callback URL as described in link like below.
It worked just by setting twittersdk:// as one callback URL, without appending anything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With