oauth-2.0 - 生成凭据身份验证错误-redirect_uri

标签 oauth-2.0 google-assistant-sdk

我在尝试生成授权代码时收到授权错误:

Error 400: invalid_request

You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy for keeping apps secure.

If you’re the app developer, make sure that these request details comply with Google policies. redirect_uri: urn:ietf:wg:oauth:2.0:oob

我已使用此 Google 教程来复制并确认该问题:

https://developers.google.com/assistant/sdk/guides/service/python/embed/install-sample?hl=en_US

它正在生成此 URL:

https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=[HIDDEN]&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fassistant-sdk-prototype&state=[HIDDEN]&prompt=consent&access_type=offline

最佳答案

这是 jdtoth 在 Github 上提供的解决方法:https://github.com/greghesp/assistant-relay/issues/266#issuecomment-1065940698

谢谢jdtoth!


I found a workaround for creating a new user. In my case, I needed to create a specific type of API credential. Here is what I did:

Create a new OAuth Client credential using the link below, ensuring the application type is "Web application" and set Authorized Redirect URIs to "http://localhost"

https://console.cloud.google.com/apis/credentials

Download the key, and create the user in the Assistant Relay appas you tried before. When it opens a new browser window to authorize the google account, you might need to bypass a warning. After you do this, a blank browser window will open but the address bar will contain the auth code you need. Grab the code from the relevant part of the URL here and paste it back into the Assistant Relay app:

http://localhost/?code=COPYCODEFROMHERE&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fassistant-sdk-prototype

Let me know if this works. I am successfully sending commands to the Assistant Relay server but nothing is playing on my speakers.

关于oauth-2.0 - 生成凭据身份验证错误-redirect_uri,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71385860/

相关文章:

oauth-2.0 - Linkedin oauth 授权失败,错误为 "Bummer, something went wrong"

authentication - 为什么我们在 Header 上传递身份验证 token ?

javascript - Angularfire2 oauth 登录中的凭据无效错误

c++ - Google Assistant SDK (C++) - 广播指令

oauth-2.0 - Alexa 帐户链接 - 如何使用 id_token 而不是访问 id_token

python - 没有名为 googlesamples.assistant.auth_helpers 的模块

android - 如何从 Android 应用程序向 Google 智能助理发送文本查询

android - 从 Android 应用程序向 Google 智能助理(特别是智能助理,而不是任何其他搜索方法)发送命令

Python 在使用 sudo 启动时找不到模块

java - Spring Security OAuth2 cookie