dgrubelic / vue-authenticate

Simple Vue.js authentication library
1.43k stars 251 forks source link

OAuth token exchange endpoint requires parameters; cannot specify them currently #199

Open rslifka opened 4 years ago

rslifka commented 4 years ago

I'm working on authenticating with Bungie to do fun things with the Destiny API. In their OAuth documentation here, they specify the parameters to be used when POSTing to their token exchange endpoint, one of which is grant_type:

grant_type: Value must be set to “authorization_code”.

Inside of exchangeForToken() it uses options.responseParams but only allows me to map params that have come back on the initial redirect. https://github.com/dgrubelic/vue-authenticate/blob/3ace24c36580d81fe4a1e748a28b997df2bbb706/src/oauth/oauth2.js#L80

Is there something I'm missing?

rslifka commented 4 years ago

If anyone else has this issue, just use the request interceptor specified in the README to add the parameters or modify the payload. It's a little hacky but it now works!