1

我正在尝试将 Github Oauth API 用于特定目的:

Github OAuth API 规范

这是我所做的:

我在我的 Github 帐户中创建了一个“应用程序”,并添加了一个应用程序 URL,例如http://example.com/和一个回调 URL http://example.com/ /。作为回报,Github 生成了一个client_idclient_secret

我使用client_id生成授权 url:

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

当我将此 URL 粘贴到浏览器中时。Github 要求我登录。一旦我使用我的凭据登录,它会要求我授权该应用程序,我这样做了。但是,它会使用临时代码返回到此 url:

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

,而不是我提供的redirect_url

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

一般来说,我希望灵活地构建自己的redirect_url,我可以在其中向 redirect_url 添加一些参数,以便区分不同的用户。

我尝试了不同的组合但没有成功。我什至尝试对redirect_url参数进行编码,但它不起作用。

4

1 回答 1

2

参数的名称不是redirect_url,而是redirect_uri(URL -> URI)。

于 2013-02-06T21:18:20.410 回答