如何为GitHub OAuth实现/破解两个回调URL

时间:2016-09-17 16:48:19

标签: node.js express oauth-2.0 github-api linkedin-api

我希望能够在GitHub OAuth的不同路由中sf['sales25percentdiscount'] = sf['Sales'].apply(lambda x: x*.0.75) (用于注册GitHub)和authenticate(用于将GitHub帐户链接到现有帐户)。我使用LinkedIn OAuth处理此问题,其中包含两个不同的路由,一个调用authorize,另一个调用passport.authenticate()。 GitHub只允许你有一个回调URL。

我发现这个post解释了一种解决方法,但不知道如何实现答案。

以下是我使用Linkedin OAuth的设置,工作正常。

passport.authorize()

1 个答案:

答案 0 :(得分:0)

如果两个网址都在同一个域,端口和协议上,您可以指定一个高于您要使用的网址的网址,例如:

如果您的网页已开启 https://example.com/oauth/authorizehttps://example.com/oauth/authenticate

你可以在github中将https://example.com/oauth设置为回调URL,并将请求中的redirect_uri参数输入到github。

更多信息: https://developer.github.com/v3/oauth/#redirect-urls