Failed to get request token on Android M running Devices - twitter

Twitter login failed in Android 6.0 preview devices. Its working fine on all other devices.
Below code is used to initialize fabric with twitter.
TWITTER_ KEY and TWITTER_SECRET keys were obtained from twitter app settings.
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(this, new Twitter(authConfig));
Here is the error log i got during login using TwitterApiClient.
08-31 07:52:09.988 4692-4692/? E/Twitter: Failed to get request token
08-31 07:52:09.988 4692-4692/? E/Twitter: com.twitter.sdk.android.core.TwitterApiException: 401 Authorization Required
08-31 07:52:09.988 4692-4692/? E/Twitter: at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:383)
08-31 07:52:09.988 4692-4692/? E/Twitter: at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
08-31 07:52:09.988 4692-4692/? E/Twitter: at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
08-31 07:52:09.988 4692-4692/? E/Twitter: at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
08-31 07:52:09.988 4692-4692/? E/Twitter: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
08-31 07:52:09.988 4692-4692/? E/Twitter: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
08-31 07:52:09.988 4692-4692/? E/Twitter: at retrofit.Platform$Android$2$1.run(Platform.java:142)
08-31 07:52:09.988 4692-4692/? E/Twitter: at java.lang.Thread.run(Thread.java:818)
08-31 07:52:10.000 4692-4692/? E/Twitter: Authorization completed with an error
08-31 07:52:10.000 4692-4692/? E/Twitter: com.twitter.sdk.android.core.TwitterAuthException: Failed to get request token
08-31 07:52:10.000 4692-4692/? E/Twitter: at com.twitter.sdk.android.core.identity.OAuthController$1.failure(OAuthController.java:95)
08-31 07:52:10.000 4692-4692/? E/Twitter: at com.twitter.sdk.android.core.internal.oauth.OAuth1aService$1.failure(OAuth1aService.java:215)
08-31 07:52:10.000 4692-4692/? E/Twitter: at com.twitter.sdk.android.core.Callback.failure(Callback.java:45)
08-31 07:52:10.000 4692-4692/? E/Twitter: at retrofit.CallbackRunnable$2.run(CallbackRunnable.java:53)
08-31 07:52:10.000 4692-4692/? E/Twitter: at android.os.Handler.handleCallback(Handler.java:739)
08-31 07:52:10.000 4692-4692/? E/Twitter: at android.os.Handler.dispatchMessage(Handler.java:95)
08-31 07:52:10.000 4692-4692/? E/Twitter: at android.os.Looper.loop(Looper.java:148)
08-31 07:52:10.000 4692-4692/? E/Twitter: at android.app.ActivityThread.main(ActivityThread.java:5417)
08-31 07:52:10.000 4692-4692/? E/Twitter: at java.lang.reflect.Method.invoke(Native Method)
08-31 07:52:10.000 4692-4692/? E/Twitter: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
08-31 07:52:10.000 4692-4692/? E/Twitter: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Before this solution, I tried a valid url (even google.com). But, in my case, it did not work.
I then found this solution, which worked well for me:
Step 1: Go to your twitter app's settings by logging in at https://apps.twitter.com/ and selecting the Settings tab, then add twittersdk:// as a callback url. (I found it in lib class.)
Step 2: Save your update.
Step 3: Try your app again.

Here are the things you need to do
Twitter dev account->setting->callBack url
and then if you are doing for the android (means login using for android devices )
twittersdk://
(add this in callback)
if you are doing for the iOS (means login using for apple devices )
twitterkit-CONSUMERKEY://
(add this in callback)
and hit update settings button
it will work :)

I have same problem and solved. In my case i need to set callback url in twitter dev account.
Twitter dev account->setting->callBack url(set any valid url like
www.google.com)

this is the best solution when twitter auth not working without app. i tried with valid firebase auth callback url but not working and i also search this problem a lot but not getting the exact solution, #Moinkhan solution worked for me and save my time, thanks to #Moinkhan, it works
Before this solution i tried valid url and even google.com too. But for my case it was not working.
i found below solution and it work well for me.
Step 1: go to your twitter app setting https://apps.twitter.com/ >> Tab settings >> Fill this text "twittersdk://" to your callback url field( i found it in lib class)
Step 2: Save your update
Step 3: check out your app again

I was facing the same issue(just moments back).
Go to Twitter Application Management ->
Click on the 'app' on which you are currently working ->
Click on 'Settings' tab ->
1) Callback URL: Insert any valid url(like homepage of your website)
2) Enable Callback Locking (It is recommended to enable callback locking to ensure apps cannot overwrite the callback url): Verify that it is unchecked
Twitter Kit tries to use a webview if the twitter app is not found.
The webview part of Twitter kit needs to override the callback url.
Info about Callback Url field clearly states: To restrict your application from using callbacks, leave this field blank.
So, we need to write down any valid url :)
Reference:
Personal experience obtained moments back :P
Failed to get request token

After going through a lot of solutions, one that worked for me is
just add - twittersdk:// as one more callback URL in the setting section of your twitter app.

Create your Your Access Token in Key and Access Token tab

I had the same problem on iOS, and found a hint here:
Apparently, it is now required to set the Callback URL to
http://twitter-oauth.callback
Sind I did so, the login works again.

Make sure your Callback Urls is inputted.
Make sure Twitter app is installed on your device(Android, iOS)
Hope this help. It work well for me (https://www.assetstore.unity3d.com/en/#!/content/79450).

Related

Execute failed error from twitter search on KNIME

I have an error on KNIME. I am trying to scrape the tweets from twitter but I have this error:
<< ERROR Twitter Search 0:2 Execute failed: 400:The
request was invalid. An accompanying error message will explain why.
This is the status code will be returned during version 1.0 rate
limiting (https://dev.twitter.com/pages/rate-limiting). In API v1.1, a
request without authentication is considered invalid and you will get
this response. message - Bad Authentication data. code - 215>>
This errors is due to you are issuing your request without authentication, first you need to authenticate against twitter and after you're be able to issue the request properly.

Skype Bot OAuth error that wasn't happening before

I previously had a Skype bot able to post messages using the API.
But on 11/17/17 I started getting this error on every attempt, and as a result, no message gets posted. I haven't changed anything.
requests.exceptions.HTTPError: 401 Client Error: The provided 'OAuth' ticket failed authentication. for url: https://apis.skype.com/v2/conversations/[conversation]/activities/
The process I use is to get an access token witha post to https://login.microsoftonline.com/common/oauth2/v2.0/token
and then to use that token to post a message to https://apis.skype.com/v2/conversations/[conversation]/activities/
It's able to get the token fine, but then when the message post is called, it raises the above exception.
I've faced with exactly the same problem and this worked for me:
I left all send messages endpoint as is for v2, BUT in token generation POST payload I've changed 'scope' -> 'https://api.botframework.com/.default'

Why is my Auth0 token always coming back as invalid when sent from iOS to node.js server?

I'm using Auth0's service for an iOS app with a server built on node.js and express.js. I've followed Auth0's docs and seed projects as best I can, but the server keeps complaining that the tokens I'm sending from my iOS application are invalid. Here's some of my code:
From the server - the authentication and route declarations, as specified in the Auth0 documentation
var authenticate = jwt({
secret: new Buffer(process.env.AUTH0_CLIENT_SECRET, 'base64'),
audience: process.env.AUTH0_CLIENT_ID
});
app.use('/api', authenticate);
app.use('/api/userquery', queries);
And from iOS, setting the header for a request (using AFNetworking):
request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
I know for a fact the request is being sent properly because it works fine for paths that don't require authentication. Lastly, here's the error I receive on the server side:
GET /api/userquery/currentUser 401 7.185 ms - 436
UnauthorizedError: invalid token
at /node_modules/express-jwt/lib/index.js:100:22
at /node_modules/jsonwebtoken/index.js:155:18
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
The issue was just that I failed to unwrap the token after pulling it out of keychain. Instead of sending "Bearer [token]" in the Authorization header, I was sending "Bearer [Optional(token)]".

OAuth2::Error with doorkeeper

Whenever I try to authenticate with doorkeeper provider, I always got the following error
invalid_grant: The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client. {"error":"invalid_grant","error_description":"The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
I tried with other doorkeeper clients but still have the same error
Doorkeeper client:
https://github.com/doorkeeper-gem/doorkeeper-devise-client.git
http://dev.mikamai.com/post/112508735689/oauth2-on-rails-the-client-application
Doorkeeper provider:
https://github.com/doorkeeper-gem/doorkeeper-provider-app.git
Though downgrading to gem 'omniauth-oauth2', '~> 1.3.1' is a confirmed to be a solution, in Doorkeeper's Create-a-OmniAuth-strategy-for-your-provider Wiki Page it is mentioned that in your implementation of OmniAuth Strategy for Doorkeeper the following method should be present:
# https://github.com/intridea/omniauth-oauth2/issues/81
def callback_url
full_host + script_name + callback_path
end
There is long discussion in the referred omniauth-oauth2 issue #81
I personally faced the reported error when I was trying to test my Rails 5 Devise-based Doorkeeper Provider by using a Rails 5 Devise-based Client app to allow Provider's users connect their account on my client-app.
In absence of the mentioned method in my OmniAuth::Strategies::Doorkeeper
on front-end Devise OmniauthCallbacksController was flashing message Invalid Credentials and in the client-app server logs following error was seen:
Started GET "/users/auth/doorkeeper" for 127.0.0.1 at 2017-08-22 17:45:02 +0530
I, [2017-08-22T17:45:02.386866 #14535] INFO -- omniauth: (doorkeeper) Request phase initiated.
Started GET "/users/auth/doorkeeper/callback?code=1b833bcc09651f98b0424a7afb1e60bd50fdcc765daf7d499bcefb5554457187&state=c215fd707ecd71c6ad0f6b5e58fa0d2da7210d86946d41e3" for 127.0.0.1 at 2017-08-22 17:45:03 +0530
I, [2017-08-22T17:45:03.506424 #14535] INFO -- omniauth: (doorkeeper) Callback phase initiated.
E, [2017-08-22T17:45:03.523737 #14535] ERROR -- omniauth: (doorkeeper) Authentication failure! invalid_credentials: OAuth2::Error, invalid_grant: The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.
{"error":"invalid_grant","error_description":"The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
Processing by Users::OmniauthCallbacksController#failure as HTML
Parameters: {"code"=>"1b833bcc09651f98b0424a7afb1e60bd50fdcc765daf7d499bcefb5554457187", "state"=>"c215fd707ecd71c6ad0f6b5e58fa0d2da7210d86946d41e3"}
Redirected to http://localhost:5000/
Completed 302 Found in 0ms (ActiveRecord: 0.0ms)
So adding that method to the strategy can be considered as an alternate solution.
Thanks.
I solved it by downgrading omniauth-oauth2 gem version to 1.3.1 mentioned here - https://github.com/intridea/omniauth-oauth2/issues/81

Authorization Failure - Invalid credentials were provided in opentok

hello friends i am right now making chat application using opentok
Authorization Failure - Invalid credentials were provided.
i am getting this error
i am getting session id and getting token starting from T1==
what to do?

Resources