You are here

function oauth2_client_set_token in OAuth2 Client 7.2

Same name in this branch
  1. 7.2 oauth2_client.module \oauth2_client_set_token()
  2. 7.2 oauth2_client.api.php \oauth2_client_set_token()
Same name and namespace in other branches
  1. 8 oauth2_client.module \oauth2_client_set_token()
  2. 8 oauth2_client.api.php \oauth2_client_set_token()
  3. 7 oauth2_client.module \oauth2_client_set_token()

Share an access token with oauth2_client.

Another oauth2 client that has been successfully authenticated and has received an access_token, can share it with oauth2_client, so that oauth2_client does not have to repeat the authentication process again.

Example: $client_id = $hybridauth->api->client_id; $token = array( 'access_token' => $hybridauth->api->access_token, 'refresh_token' => $hybridauth->api->refresh_token, 'expires_in' => $hybridauth->api->access_token_expires_in, 'expiration_time' => $hybridauth->api->access_token_expires_at, 'scope' => $hybridauth->scope, ); $token_endpoint = $oauth2->api->token_endpoint; $client_id = $oauth2->api->client_id; $auth_flow = 'server-side'; $id = md5($token_endpoint . $client_id . $auth_flow); oauth2_client_set_token($id, $token);

File

./oauth2_client.module, line 151
Provides OAuth2 client functionality.

Code

function oauth2_client_set_token($id, $token) {
  OAuth2\Client::storeToken($id, $token);
}