Skip to content

How to customize the redirect URL when registering a Github App? #61238

Discussion options

You must be logged in to vote

When Request user authorization (OAuth) during installation is enabled, GitHub seems to always redirects to the first Callback Url you set in your app settings, regardless of any redirect_uri parameters you pass.

My workaround, makes use of the fact that the state query param is persisted across the install and redirect, so you can "embed" the desired redirect url in the state.

  1. Set the first Callback Url in the app settings to a redirect page hosted on your domain:
    https://your-domain.com/redirect/
  2. Generate a random state, join it with your redirect url and use the whole thing as your state parameter when installing
    github.com/apps/<our-app-name>/installations/new?state=<RANDOMSTATE><DES…

Replies: 18 comments 9 replies

This comment was marked as off-topic.

@pieterbreed
Comment options

Comment options

You must be logged in to vote
2 replies
@pieterbreed
Comment options

@Yashasv-Prajapati
Comment options

Comment options

You must be logged in to vote
1 reply
@pieterbreed
Comment options

Comment options

You must be logged in to vote
2 replies
@horlah
Comment options

@iamnotstatic
Comment options

Comment options

You must be logged in to vote
1 reply
@simdd
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ossanna16
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@RihanArfan
Comment options

Comment options

You must be logged in to vote
1 reply
@adhami3310
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API and Webhooks Discussions related to GitHub's APIs or Webhooks Question Ask and answer questions about GitHub features and usage