2014-05-12 46 views
1

我想爲Google Developer Console中的「安裝的應用」類配置重定向網址的自定義端口。在Google OAuth 2.0中爲「localhost」重定向網址配置自定義端口

https://developers.google.com/accounts/docs/OAuth2InstalledApp的說明,事實證明,這應該是可能的:

redirect_uri=http://localhost:9004&

要去控制檯( 「console.developers.google.com」), 「資格證書」 和「創建新的客戶端ID「,我無法找到該字段,在哪裏輸入自定義端口號。有誰知道如何做到這一點?

謝謝!

+0

對於已安裝的應用程序,redirect_url是固定的,它可以是'urn:ietf:wg:oauth:2.0:oob'或'http:// localhost',如果你想使用,你不能在控制檯中編輯端口,只要使用它,像'redirect_uri = http:// localhost:9004',它可以工作。 –

回答

4

事實上,你已經讀過這份文件已經回答了你的問題:

當您創建的谷歌開發者控制檯客戶端ID,二redirect_uris中爲您製作:urn:ietf:wg:oauth:2.0:oobhttp://localhost。應用程序使用的值決定了授權代碼如何返回到您的應用程序。

http://localhost發信號給Google授權服務器,授權代碼應作爲查詢字符串參數返回給客戶端上的Web服務器。 您可以在不更改Google Developers Console配置的情況下指定端口號。

+0

感謝您的幫助,這對我來說並不明顯。 – user2969932

0

我試過這個想法,它的工作原理。 給連續的端口或可能端口憑據

**Redirect URIs** 
http://localhost:55738/YoutubeVideoList.aspx 
http://localhost:8080/YoutubeVideoList.aspx 
http://localhost:8081/YoutubeVideoList.aspx 
http://localhost:8082/YoutubeVideoList.aspx 
http://localhost:8083/YoutubeVideoList.aspx 
http://localhost:8084/YoutubeVideoList.aspx 

,不要忘了給正確redirectURI與港口(以上人),同時調用認證過程。