systemboot
systemboot

Reputation: 862

How to use Github OAuth redirect_url parameter?

I am trying to use the Github Oauth API for a specific purpose:

Github OAuth API Specs

Here is what I did:

I created an "Application" in my Github account, and added an application URL say http://example.com/ and a Callback URL http://example.com//. Github, in return, generated a client_id and client_secret.

I used the client_id to generate an authorization url:

https://github.com/login/oauth/authorize?client_id=<client_id>&scope=repo&redirect_url=http://example.com/auth/

When I paste this URL in the browser. Github asks me sign-in. Once I sign in with my credentials, it asks me to authorize the application, which I do. However, it returns to this url with a temporary code:

 http://example.com/?code=<temporary code>

, instead of the redirect_url that I had provided:

   http://example.com/auth/?code=<temporary code>

In general, I want the flexibility to construct my own redirect_url, where I can add few parameters to the redirect_url so that I can distinguish between different users.

I'v tried different combinations without any success. I've even tried to encode the redirect_url parameter but it does not work.

Upvotes: 1

Views: 2337

Answers (1)

Ivan Zuzak
Ivan Zuzak

Reputation: 18762

The name of the parameter is not redirect_url, it is redirect_uri (URL -> URI).

Upvotes: 3

Related Questions