Can someone help me understand redirect uri's in Github's OAuth2

So I have everything working to the point at which I’m able to get a user’s access token. However, currently what I’d like to do is have github redirect the user to a ‘you have been validated’ page. 

Unfortunately it seems that Github doesn’t like it when I use anything other than my application’s callback URI for the redirect-uri property that I pass in. My current web application flow: 

  1. Send client_id to: https://github.com/login/oauth/authorize

  2. My application’s callback is /authentication, and I have that as part of the query. 

  3. Listen on the "/authentication’ endpoint and extract code from the query object.

  4. Post to: https://github.com/login/oauth/access_token. With my redirect uri being: 

redirect_uri: “http://localhost:8080/authentication

Now if I try to change that to say: 
http://localhost:8080/authentication/validated
(Which does exist as a react router component). 
I still get the token, and there’s a data object in the response showing that it received my redirect_uri. But it doesn’t load the page, or rather, the page is stuck on an infinite load.

1 Like

It sounds like you’re trying to use the web-style flow for a local application (since the final redirect URI you have is for localhost). Have you tried using the non-Web application flow instead?