-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LinkedIn error: "The token used in the request is expired" #17
Comments
There's a thread here: http://developer.linkedin.com/forum/unauthorized-invalid-or-expired-token-immediately-after-receiving-oauth2-token with a lengthy discussion and several possible workarounds. |
Hi Folks, Kamyar here with LinkedIn. This should be resolved in production. Please Regards, On Tue, Feb 25, 2014 at 4:07 AM, Fernando Mendez
|
It doesn't work now. Without "sleep 5" I get 401 error with "message": "Then token used in this request has been revoked by the user.". |
I am getting the same 401 error when trying to retrieve the user info with the correct token. And works every time if I put 5 seconds sleep. Is there any workaround to this? |
Any update? Surprised this is still an issue but seeing the same error. |
Same error here, it popped up in the past weeks. Before that, things were working correctly. |
I am getting the same 401 error when trying to retrieve the user info with the correct token using Oauth2.0. { |
@Ahamathullah I have resolved an issue by adding a delay after calling a request when obtaining the token. Go with 5-6 seconds. LinkedIn doesnt seem to activate the token that it gives immediately, so waiting a bit helps. |
I'm still getting this error too
I know the token has not expired because I have just literally refreshed it. |
I am facing this problem as well. Even the introspect api call Adding delay won't work for me because it does not go well with the user experience. Imagine keeping the user waiting for 5 seconds after they have authorized the app to access LinkedIn. This needs to be solved! |
I'm also facing this problem. I'm generating access tokens from a refresh token. If I use the access token immediately, but if I wait a few minutes, it miraculously works. This means that any integration tests I run that generate an access token for immediate use ALWAYS fail -- update. I didn't realize where I was posting this. My comment really belong on some LinkedIn developer page, not here. I will leave it here anyway though so that others realize this is a LinkedIn problem, and not an issue with this repo |
+1 I can also confirm that this an issue as I am seeing the EXACT same thing as the last two posters. Glad to know though that it's not something I'm doing wrong in my code (finally). This definitely needs to be fixed. I'm hoping someone from the dev team is monitoring this issue/post. EDIT: |
I am facing this issue. Has anyone solved this? |
It's been 7 years since a Linkedin dev replied on this thread. I wouldn't get my hopes up that this has been or ever will be resolved. |
As of this comment, this issue still persists. The following stackoverflow answers suggested to include all the params sent to https://stackoverflow.com/questions/25488172/linkedin-api-the-token-used-in-the-oauth-request-has-been-revoked This works! To achieve this using this gem, monkey patch the client options for the oauth2 client to include module OmniAuth
module Strategies
class LinkedIn
option :client_options, {
:site => 'https://api.linkedin.com',
:authorize_url => 'https://www.linkedin.com/oauth/v2/authorization?response_type=code',
:token_url => 'https://www.linkedin.com/oauth/v2/accessToken',
:token_method => :post_with_query_string
}
end
end
end |
I tried this out in C# using RestSharp |
Our solution is to call introspect token in a loop with a delay of 250ms until we get TEN!!!! 10 responses saying the token is valid. This is the only method that appears to work consistently |
@joeEulerity Hey! Can you show an example of how you implemented that? I'm having the same issue for a couple of weeks and nothing i tried could solve the problem. |
@lucca-oliveira I don't actually use this github project, so I can't provide a code sample. I only found this while searching for solutions to the LinkedIn API issue I was having. But essentially it would look something like this language agnostic pseudocode token = generateToken(params) |
@joeEulerity Thanks buddy! |
Following this. It's been 10 years! 🤔🥲 |
Just want to say thank you - this is the solution for what is effectively an intermittent failure. Devs - please create a patch into upstream here. For those wondering how to implement, the easiest solution for now is to drop this code into config/initializers/linkedin_monkey_patch.rb. |
I'm getting the following error when I'm using this gem.
OAuth2::Error at /auth/linkedin/callback
: { "errorCode": 0, "message": "The token used in the request is expired.", "requestId": "5LVAAP7YZ2", "status": 401, "timestamp": 1392084765723 }
file: client.rb location: request line: 110
So it actually looks like a problem with LinkedIn. I was seeing it intermittently, so I surmised it was a timing issue. Low and behold if I put a 10 second sleep in there it works every time.
I'm wondering if anyone else has seen this behavior?
The text was updated successfully, but these errors were encountered: