如何在谷歌开发者控制台中设置redirect_uri? [英] How to set redirect_uri in google developer console?

查看:37
本文介绍了如何在谷歌开发者控制台中设置redirect_uri?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过在开发者控制台注册我的项目获得了客户端 ID 和 API 密钥.在运行身份验证过程时,我收到这样的错误400. 那是一个错误.错误:redirect_uri_mismatch请求中的重定向 URI:http://localhost:8080/ 与注册的重定向 URI 不匹配.>

我没有注册任何重定向uri.任何人都可以解决这个问题或告诉我如何设置重定向 uri.我在注册时找不到任何重定向 url.

解决方案

重定向 URI 是一个对象,仅供进行 oAuth2 身份验证的 Web 应用程序使用;因此,当您创建新的客户端 ID 时,请选择Web 应用程序"作为 ID 类型,然后会出现一个文本区域,您可以在其中输入所有允许的重定向 URI(这些网页将由您编码,并且需要执行做oauth2票证验证的功能).

如果您的应用不是网络应用,您选择已安装的应用"作为类型,您将获得一个可在 Android/iOS/桌面应用中使用的密钥.但是,此密钥在 Web 应用程序中根本无法使用.

如果您的网络应用程序不需要写入任何数据或上传任何文件,您可以创建一个公共 API 密钥,您只需将其作为参数包含在您的请求中即可.

服务帐户(您在上图中显示)与 YouTube API 不兼容.

I got the Client Id and API Key by registering my project with developer console. And While running authentication process i get an error like this 400. That’s an error. Error: redirect_uri_mismatch The redirect URI in the request: http://localhost:8080/ did not match a registered redirect URI.

I have not registered any redirect uri. Can anyone fix this or tell me how to set the redirect uri.I could not find any redirect url while registering.

解决方案

The redirect URI is an object only used by web applications that are doing oAuth2 authentication; so, when you create a new client ID, choose "web application" as the ID type and there will be a text area where you enter all of the allowed redirect URIs (these web pages will be coded by you, and will need to perform the function of doing the oauth2 ticket verification).

If your app is not a web application, you choose "installed application" as the type and you'll get a key that can be used in an Android/iOS/desktop app. However, this key will NOT be useable, at all, in a web application.

If your web application doesn't need to write any data or upload any files, you can create a public API key that you just include as a parameter with your requests.

Service accounts (which you're showing in the image above) are not compatible with the YouTube API.

这篇关于如何在谷歌开发者控制台中设置redirect_uri?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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