Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Conversation

@glacials
Copy link
Contributor

A provider I'm implementing custom OAuth support for is returning a 400 when refreshing a token. For context, this is the full error body from the service:

AccessTokenResponse (HTTP 400 - 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.)

accessToken:null
error:"invalid_grant"
errorDescription:"The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization requ…"
errorUri:null
expirationDate:null
expiresIn:null
httpStatusCode:400
refreshToken:null
scope:null
tokenType:null
hashCode:723283890
runtimeType:Type (AccessTokenResponse)

However oauth2_client swallows this error and continues on as if the response was a success, eventually causing a hard-to-understand error later, when tknResp.isBearer() is called on a response that has no token in it:

NoSuchMethodError: The method 'toLowerCase' was called on null.

This branch adds an explicit check for an error response, and throws an exception with more helpful information if so.

okrad added a commit that referenced this pull request Jan 31, 2021
@okrad okrad merged commit 65232e8 into teranetsrl:master Jan 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants