UserCredentials with Restler

Does anybody have a sample with OAuth2_GrantType_UserCredentials and Restler ? I've tried myself but it's very difficult to understand

Thanks


Not sure exactly what you're asking. If you have OAuth 2 set up already on your server, you just need to change the grant_type to 'client_credentials' and pass the client_id and client_secret in exchange for the token. For example, on my index.php page, I was able to get a token by passing:

index.php/grant?grant_type=client_credentials&client_id=demoapp&client_secret=demopass

Hope this helps.


In your storage class, in my case PDO, you need to look at the following functions. Make sure you have your validations in the first one.

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

Then

POST https://{your_server}/token

With the following payload (obviously changed to suit your environment):

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

The important one here is the grant_type, it actually is 'password' for what you are attempting.

链接地址: http://www.djcxy.com/p/66088.html

上一篇: Luracast Restler不在Google App Launcher上工作

下一篇: 具有Restler的UserCredentials