function oauth2_client_set_token in OAuth2 Client 7.2
Same name in this branch
- 7.2 oauth2_client.module \oauth2_client_set_token()
- 7.2 oauth2_client.api.php \oauth2_client_set_token()
Same name and namespace in other branches
- 8 oauth2_client.module \oauth2_client_set_token()
- 8 oauth2_client.api.php \oauth2_client_set_token()
- 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.api.php, line 138 - The programing interface provided by the module oauth2_client.
Code
function oauth2_client_set_token($client_id, $token) {
OAuth2\Client::storeToken($client_id, $token);
}