8000 Release Version 0.2.0 · oauth-io/sdk-php · GitHub
[go: up one dir, main page]

Skip to content

Version 0.2.0

Compare
Choose a tag to compare
@william26 william26 released this 10 Jun 23:11
· 25 commits to master since this release
  • New, more polyvalent auth method
  • Token renewal support when available

The 0.2.0 changes a bit the syntax to perform the authentication and to retrieve a request object to make API requests.

Authenticating the user with a code

$request_object = $oauth->auth('provider', array(
    'code' => 'the_code_you_got_from_the_front_end'
));

This saves also the credentials in the session for the duration of the user's visit.

Authenticating the user from the session

$request_token = $oauth.auth('provider');

Authenticating the user from saved credentials

You can save a user's credentials (what's returned by OAuth.io, an array containing the access_token, refresh_token, etc) in the data storage of your choice. To retrieve the credentials, do this:

$credentials = $request_object->getCredentials();

Later, you can use this array like this to rebuild a $request_object:

$request_token = $oauth->auth('provider', array(
    'credentials' => $credentials
));

Note that the credentials are automatically refreshed through the auth method if the access token is expired.

0