What callback url should i use while registering my app with oauth github, provided i do not have a website or a server side

Viewed 624

I simply used this url myapp://callback , but after signing in to github, it was redirected to a page showing error code 404 not found.

1 Answers

The OAuth flow consists of three steps:

  • Users are redirected to request their GitHub identity
  • Users are redirected back to your site by GitHub
  • Your app accesses the API with the user's access token

What you're seeing is step 2, and it's important because the callback contains data that your application needs to create an access

If the user accepts your request, GitHub redirects back to your site with a temporary code in a code parameter as well as the state you provided in the previous step in a state parameter. If the states don't match, the request was created by a third party and the process should be aborted.

More details about this flow can be found in the GitHub docs:

https://developer.github.com/apps/building-integrations/setting-up-and-registering-oauth-apps/about-authorization-options-for-oauth-apps/#web-application-flow

Related