deno-oauth2-client icon indicating copy to clipboard operation
deno-oauth2-client copied to clipboard

Handle non standard error response

Open w3cj opened this issue 2 years ago • 0 comments

I was using this library to integrate with Twitch OAuth, and I ran into an issue where the Twitch Token API response was non standard and I had no way to debug the response body (the response.body property was already read and could not be cloned). This PR attaches the parsed body to the response object for easier debugging.

BTW for anyone else that comes across this error integrating Twitch OAuth, the fix was to include the clientId and clientSecret in the body of the token request (again, another non standard thing the twitch API is asking for):

strategy.code.getToken('some-url-here?code=code-value-here&scope=', {
  requestOptions: {
    body: {
      // twitch doesn't seem to support RFC6749..., so add the client_id and client_secret to the body
      client_id: "value-here",
      client_secret: "value-here",
    }
  }
});

w3cj avatar Aug 10 '22 06:08 w3cj