Ошибка invalid_grant при отправке запроса моему провайдеру oauth - PullRequest
0 голосов
/ 31 мая 2018

Я использую драгоценный камень Doorkeeper , чтобы представить функциональность поставщика OAuth 2 в моем приложении Rails.Я добавил гем в gemfile, сконфигурировал его и попытался сделать пост-запрос для получения токена доступа, как описано в документации .

Я отправил пост-запрос на этот URL-адрес - http://localhost:3000/oauth/token с такими параметрами:

client_id=c094523a20444ee3362e8eb33e08b5266cfb6486babe9f918c0c88104e67f6c0&client_secret=d6cebe57e475e685beb2401108438991e94f0078152d52a2da4d5f1307a4729c&code=c2f56975ba6970634deef1e256faa5de5b146f794f37b3c59f3b5111d6810ef6&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob

Но я получаю сообщение об ошибке:

{"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."}

Мой инициализатор дверного проема:

Doorkeeper.configure do
  # Change the ORM that doorkeeper will use (needs plugins)
  orm :active_record

  # This block will be called to check whether the resource owner is authenticated or not.
  resource_owner_authenticator do
    current_user || warden.authenticate!(scope: :user)
  end
end

1 Ответ

0 голосов
/ 09 августа 2018

У меня была точно такая же проблема с привратником 4.3+. Решением является использование привратника 4.2.6

.
...