HWIOAuthBundle用于webapp的Google登录device_id和device_name

use*_*035 13 symfony fosuserbundle google-oauth hwioauthbundle

我正在开发一个Symfony2应用程序.我正在使用FOSUserBundle来处理身份验证,最近使用本教程将其与FOSUserBundle集成:https://gist.github.com/danvbe/4476697 .

问题是:我可以在localhost上使用google api登录,一切正常.

但是,当我尝试登录真实服务器时,我得到:

Error: invalid_request

device_id and device_name are required for private IP: http://<server_ip>/login/check-google
Run Code Online (Sandbox Code Playgroud)

请求详情:

response_type=code
scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile
redirect_uri=http://<server_ip>/login/check-google
client_id=<my_id>
Run Code Online (Sandbox Code Playgroud)

Google文档没有提到这两个参数.我尝试手动发送请求,其中device_id是UUID,device_name设置为"notes".我这次得到的回应是:

Error: invalid_request

Device info can be set only for native apps.
Run Code Online (Sandbox Code Playgroud)

请求详情:

cookie_policy_enforce=false
response_type=code
device_name=notes
scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile
redirect_uri=http://<server_ip>/login/check-google
device_id=4b3403665fea6
client_id=<my_id>
Run Code Online (Sandbox Code Playgroud)

现在,我做错了什么?

Les*_*Rel 2

看来您使用了错误的 oauth 风格。device_id 与Devices一起使用。我真的希望您能够使用WebServer流程​​。您可能需要其他流程之一,因为我在这里没有看到足够的细节来判断,但它们都可以在链接中找到。