OAuth2使用摔跤手授予类型用户凭据

时间:2014-01-09 21:01:48

标签: restler

是否有人拥有OAuth2_GrantType_UserCredentials和Restler的示例? 我已经尝试过了,但很难理解

由于

2 个答案:

答案 0 :(得分:0)

不确定你究竟在问什么。如果您已在服务器上设置了OAuth 2,则只需将grant_type更改为“client_credentials”并传递client_id和client_secret以换取令牌。例如,在我的index.php页面上,我可以通过传递:

来获取令牌

的index.php /授予grant_type = client_credentials&安培; CLIENT_ID = demoapp&安培; client_secret = demopass

希望这有帮助。

答案 1 :(得分:0)

在您的存储类中,在我的PDO案例中,您需要查看以下功能。确保您在第一个验证中有验证。

public function checkUserCredentials($email, $password) {}
public function getUserDetails($username) {}

然后

POST https://{your_server}/token

使用以下有效负载(显然已根据您的环境进行了更改):

email=me@myemail.com&
password=mypassword&
grant_type=password
client_id=myclient_id

这里重要的是grant_type,它实际上是你正在尝试的'密码'。

相关问题