Skip to content

How to use the redirect_uri parameter in github apps with multiple callback urls #54273

Discussion options

You must be logged in to vote

I don't know about the common best practices but this is how you can use multiple redirect URLs for authenticating users: https://docs.github.com/en/apps/creating-github-apps/guides/building-a-login-with-github-button-with-a-github-app#handle-multiple-callback-urls

Example: In your Github App configurations define a callback url for each envirnment:

Then when directing the user, add the wanted redirect_url as a query paramenter e.g. https://github.com/login/oauth/authorize?client_id=12345&state=abcdefg&redirect_url=http%3A%2F%2Fprod.environment.com%2Fcallback. This will then redirect the user to the production envionment.

As described in the documentation if you don't specify a redirect_…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@leecalcote
Comment options

@merijn-weiss
Comment options

@Hexi1997
Comment options

@Yashasv-Prajapati
Comment options

@rtpa25
Comment options

Answer selected by leecalcote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API and Webhooks Discussions and conversations related to APIs or Webhooks Question
6 participants