Configuring a custom port for the 'localhost' redirect URL in Google OAuth 2.0

StackOverflow https://stackoverflow.com/questions/23618245

  •  21-07-2023
  •  | 
  •  

문제

I want to configure a custom port for the redirect URL in the Google Developer Console for the class of 'Installed Apps'.

Following the instructions in https://developers.google.com/accounts/docs/OAuth2InstalledApp , it turns out that this should be possible:

redirect_uri=http://localhost:9004&

Going to the Console ("console.developers.google.com"), "Credentials", and "Create New Client Id", I cannot find the field, where to enter a custom port number. Does anyone know how to do this?

Thanks!

도움이 되었습니까?

해결책

In fact, The document you've read has answered you question:

When you create a client ID in the Google Developers Console, two redirect_uris are created for you: urn:ietf:wg:oauth:2.0:oob and http://localhost. The value your application uses determines how the authorization code is returned to your application.

http://localhost signals to the Google Authorization Server that the authorization code should be returned as a query string parameter to the web server on the client. You may specify a port number without changing the Google Developers Console configuration.

다른 팁

I tried this idea and it works. Give consecutive ports or probable ports in credentials as

**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

and don't forget to give correct redirectURI with port(anyone above) while calling the authentication process.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top