nxtbgthng / OAuth2Client

Client library for OAuth2 (currently built against draft 10 of the OAuth2 spec)
855 stars 217 forks source link

Fix dropped 401 response when token present #209

Open va7map opened 8 years ago

va7map commented 8 years ago

When a 401 response comes back to a request made with a token, if the WWW-Authenticate header does not contain the keywords invalid_token or expired_token, the connection will get dropped silently because - requestAccessAndRetryConnection: expects no tokens.

This fix adds an extra condition to ensure that it doesn't attempt to request access when the OAuth2Client's access token is present. The connection won't get dropped and the response handler will be called.