Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable switching of RedirectURI in ConfigFromJSON function #693

Open
filiprejmus opened this issue Jan 11, 2024 · 1 comment
Open

Enable switching of RedirectURI in ConfigFromJSON function #693

filiprejmus opened this issue Jan 11, 2024 · 1 comment

Comments

@filiprejmus
Copy link

What version of Go are you using (go version)? - 1.21.5
What operating system and processor architecture are you using? - Mac OS 14 - ARM

What did you do?

Used oauth2 v0.15.0 for google to load my oauth2 config and exchange my code for a token.
In my Google Oauth Credential I have 2 Redirect URIs set up which means that they get parsed as an array of two RedirectURIs by
ConfigFromJSON

What did you expect to see?

Be able to set explicitly which RedirectURI gets loaded and returned as the config

What did you see instead?

The URL is set automatically to the first URL in the list.

RedirectURL: c.RedirectURIs[0]

It would help to have a possibility to set the wanted URL. In my example I use different redirect urls for staging, dev and prod and had invalid codes returned because the dev url was used in staging. This behavior also makes it hard to catch bugs like mine.

I'm happy to contribute a patch once we agree on the best way forward.

@Koommuang7
Copy link

What version of Go are you using (go version)? - 1.21.5 What operating system and processor architecture are you using? - Mac OS 14 - ARM

What did you do?

Used oauth2 v0.15.0 for google to load my oauth2 config and exchange my code for a token. In my Google Oauth Credential I have 2 Redirect URIs set up which means that they get parsed as an array of two RedirectURIs by ConfigFromJSON

What did you expect to see?

Be able to set explicitly which RedirectURI gets loaded and returned as the config

What did you see instead?

The URL is set automatically to the first URL in the list.

RedirectURL: c.RedirectURIs[0]

It would help to have a possibility to set the wanted URL. In my example I use different redirect urls for staging, dev and prod and had invalid codes returned because the dev url was used in staging. This behavior also makes it hard to catch bugs like mine.

I'm happy to contribute a patch once we agree on the best way forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants