R
R
root092017-01-07 15:34:59
In contact with
root09, 2017-01-07 15:34:59

Laravel and authorization through VKontakte, why does an error sometimes appear?

Connected socialiteproviders.github.io/providers/vkontakte
But sometimes an error appears:

ClientException in RequestException.php line 111:
Client error: `POST https://oauth.vk.com/access_token` resulted in a `401 Unauthorized` response:
{"error":"invalid_grant","error_description":"Code is invalid or expired."}

If you follow the authorization link 10 times, then in 1-2 cases this error will occur, what could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrzej Wielski, 2017-01-07
@root09

You are using authorization incorrectly.
You can get an access_token via oauth only once. All subsequent requests will return an error.
For a solution, you can hang a try ... catch handler and, in the event of a ClientException, re-initialize authorization.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question