我正在尝试使用<cfoauth>
标记进行登录,但无法执行此操作。它正在显示
错误:invalid_request
以下是我的代码。
<cfoauth
type = "google"
clientid = "*****************es7t0r6qc"
secretkey = "**************tSF97WncM5ix9jtvD200"
result = "result"
scope="https://www.googleapis.com/auth/plus.me"
redirecturi = "http://192.168.9.126:8088/bootstrap-blog-template/tpl/cfoauth.cfm"
>
请帮忙。
答案 0 :(得分:5)
问题似乎与redirecturi
有关。您需要提供身份验证后要重定向到的页面的现有且有效的URL。
例如,如果您要测试代码的网页的本地网址是http://localhost:8500/cfbuster/login.cfm,那么redirecturi
可以是同一页面,即http://localhost:8500/cfbuster/login.cfm或其他网页http://localhost:8500/cfbuster/doLogin.cfm。
除此之外,您要设置的redirecturi
应保存在 Google Developers Consele&gt;&gt;中。 API Manager&gt;&gt; Authorized redirect URIs
下的凭据屏幕。就我而言,它是http://localhost:8500/cfbuster/test.cfm
如果传递的redirecturi
不存在或未在API Authorized redirect URIs
屏幕中保存,我们会收到以下错误消息:
注1 :redirecturi
必须有协议。不能包含URL片段或相对路径。不能是公共IP地址。
注意2 :https://www.googleapis.com/auth/plus.login是推荐的登录范围。建议不要将https://www.googleapis.com/auth/plus.me范围用作登录范围,因为对于尚未升级到Google+的用户,它不会返回用户的姓名或电子邮件地址。