badgateway / oauth2-client

OAuth2 client for Node and browsers
https://www.npmjs.com/package/@badgateway/oauth2-client
MIT License
269 stars 31 forks source link

Use URL searchParams when construction in `getAuthorizeUri` #124

Open WeeJeWel opened 11 months ago

WeeJeWel commented 11 months ago

Google requires ?access_type=offline in the authorization url:

https://accounts.google.com/o/oauth2/auth?access_type=offline&prompt=consent

This library concats ?client_id= which leads to two ?.

A more elegant way would be to use new URL() and then .searchParams.append('client_id', ...).