function oauth2_login_get_access_token in OAuth2 Login 7.2
Same name in this branch
- 7.2 oauth2_login.module \oauth2_login_get_access_token()
- 7.2 oauth2_login.api.php \oauth2_login_get_access_token()
Same name and namespace in other branches
- 8 oauth2_login.api.php \oauth2_login_get_access_token()
Get an access_token, or NULL if there is no valid token.
The token returned may be a cached one or a refreshed token. If the refresh_token has also expired, a redirection to the oauth2 server will be made, in order to re-authenticate. However the redirection will be skipped if the parameter $redirect is FALSE, and NULL will be returned as access_token.
1 call to oauth2_login_get_access_token()
- oauth2_user_is_authenticated in oauth2_user/
authenticate.inc - Return true if the user has a valid oauth2 access_token.
File
- ./
oauth2_login.module, line 162 - Provides OAuth2 Login functionality.
Code
function oauth2_login_get_access_token($redirect = TRUE) {
$oauth2_settings = oauth2_login_get_oauth2_settings();
$oauth2 = new OAuth2\Client($oauth2_settings);
$access_token = $oauth2
->getAccessToken($redirect);
return $access_token;
}