如何为 Google OAuth 2 添加多个重定向 URI? [英] How to add multiple redirect URIs for Google OAuth 2?

查看:36
本文介绍了如何为 Google OAuth 2 添加多个重定向 URI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 中,规定:

<块引用>

redirect_uri:为该项目列出的 redirect_uri 值之一在开发者控制台中.

确定发送响应的位置.这此参数的值必须与列出的值之一完全匹配对于 Google Developers Console 中的这个项目(包括 http或 https 方案、大小写和尾随/").

我有几个问题:

  • 如何向我的应用添加多个 redirect_uri?
  • 为什么 Google 将我的应用标识为项目默认服务帐户"而不是我的爱好应用"?

解决方案

它实际上比你想象的要容易,不幸的是,我花了几个小时才弄明白.

如何向我的应用添加多个 redirect_uri?

通常,当你在 Google 或其他地方添加多个链接时,你会用 ; 将它们分开,但是对于重定向 URI,你必须使用一个新行,它实际上是不是很直观.因此,当您按下 Edit Settings 按钮时,如果您有更多链接,您可以添加到 URI 和/或 Origins,以换行符 (enter) 分隔.>

无需复杂的应用配置或新密钥.

为什么 Google 将我的应用标识为项目默认服务帐户"?而不是我的爱好应用程序"?

关于您的第二个问题:您必须转到同意屏幕";选项卡以更改您的应用信息,例如您的 PRODUCT NAMEHOMEPAGELOGO 等.

I am trying to make Google OAuth 2 authentication work with a toy app I am running on my computer (at localhost:8080) using Social Auth for Java.

However when my app connects to Google to authenticate the user, Google responds with this error page:

My app, named "My Hobby App", is configured in the Developer Console as such:

In the Google OAuth 2 docs, it is specified that:

redirect_uri: One of the redirect_uri values listed for this project in the Developers Console.

Determines where the response is sent. The value of this parameter must exactly match one of the values listed for this project in the Google Developers Console (including the http or https scheme, case, and trailing '/').

I have a couple of questions:

  • How can I add multiple redirect_uris to my app?
  • Why is Google identifying my app as "Project Default Service Account" rather than "My Hobby App"?

解决方案

It's actually easier than you think, unfortunately, it took me a couple of hours to figure it out.

How can I add multiple redirect_uris to my app?

Normally when you add multiple links to something on Google or elsewhere you separate it by , or ; but with Redirect URIs you have to use a new line, it's actually not very intuitive. So when you press the Edit Settings button, you can add to the URI and/or Origins if you have a couple more links, separated by newlines (enter).

No need for complicated app configurations or new keys.

Why is Google identifying my app as "Project Default Service Account" rather than "My Hobby App"?

On your second question: You have to go to the "Consent Screen" tab to change your app info such as your PRODUCT NAME, HOMEPAGE, LOGO, etc.

这篇关于如何为 Google OAuth 2 添加多个重定向 URI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆