Symfony2 FOSOAuthServerBundle 授权类型密码需要客户端密码 [英] Symfony2 FOSOAuthServerBundle grant type password requires client secret

查看:61
本文介绍了Symfony2 FOSOAuthServerBundle 授权类型密码需要客户端密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在集成 FOSOAuthServerBundle 来处理从移动应用程序到 Symfony2 后台的登录.我已经按照 this answer 的说明进行操作,但因为我之前从未使用过 OAuth2有时我会有点迷茫.

I'm integrating FOSOAuthServerBundle to handle login from a mobile app to a Symfony2 backoffice. I've followed the instructions of this answer, but as I've never used OAuth2 before I'm a bit lost sometimes.

我尝试使用密码"grant_type 登录,但由于某种原因它无法工作,除非我将 client_secret 指定为 GET> 参数.我真的应该这样做吗?

I tried logging in using the 'password' grant_type but for some reason it won't work unless I specify the client_secret as a GET parameter. Am I actually supposed to ?

这是我的请求的样子:

http://myserv.local/app_dev.php/oauth/v2/token?client_id=1_4up4x3hpaask4g0sok0so8sg00gk48c44cc0wkwwsg8048wcog&grant_type=密码&用户名=test@test.com&password=somepassword

除非添加了 client_secret 参数,否则它会返回此响应:

It returns this response unless the client_secret parameter is added:

{"error":"invalid_client","error_description":"客户端凭据无效"}

推荐答案

当你使用唯一允许的授权类型密码"创建一个新客户端时,这不应该是一个安全问题,因为客户端机密是公开的,没有人将能够通过 client_credential 授权使用它.

When you create a new client with the only allowed grant type "password", that shouldn't be a security issue that the client secret is public and no one will be able to use it with client_credential grant.

这篇关于Symfony2 FOSOAuthServerBundle 授权类型密码需要客户端密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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