Property | Type | Description | |
---|---|---|---|
$BD_OAUTH2_ENDPOINTS | Endpoints for Baidu OAuth2.0. |
Property | Type | Description | |
---|---|---|---|
$clientId | |||
$clientSecret | |||
$redirectUri |
Method | Description | |
---|---|---|
__construct ( string $clientId, string $clientSecret ) | Constructor | |
getAccessTokenByAuthorizationCode ( string $code ) : array | false | Get access token ifno by authorization code. | |
getAccessTokenByClientCredentials ( string $scope = '' ) : array | false | Get access token info by client credentials. | |
getAccessTokenByDeveloperCredentials ( string $accessKey, string $secretKey ) : array | false | Get access token info by developer credentials | |
getAccessTokenByRefreshToken ( string $refreshToken, string $scope = '' ) : array | false | Refresh access token by refresh token. | |
getAuthorizeUrl ( string $responseType = 'code', string $scope = '', string $state = '', string $display = 'popup' ) : string | Get baidu oauth2's authorization granting url. | |
getLogoutUrl ( string $accessToken, string $next = '' ) : String | Get a Logout URL suitable for use with redirects. | |
getRedirectUri ( ) : string | Get the redirect uri for the app. | |
makeAccessTokenRequest ( array $params ) : mixed | Make an oauth access token request | |
setRedirectUri ( $redirectUri ) : BaiduOAuth2 | Set the redirect uri for the app. |
public __construct ( string $clientId, string $clientSecret ) | ||
$clientId | string | Client_id of the baidu thirdparty app or access_key of the developer. |
$clientSecret | string | Client_secret of the baidu thirdparty app or secret_key of the developer. |
public getAccessTokenByAuthorizationCode ( string $code ) : array | false | ||
$code | string | Authorization code |
return | array | false | returns access token info if success, or false if failed |
public getAccessTokenByClientCredentials ( string $scope = '' ) : array | false | ||
$scope | string | Extend permissions delimited by blank space |
return | array | false | returns access token info if success, or false if failed. |
public getAccessTokenByDeveloperCredentials ( string $accessKey, string $secretKey ) : array | false | ||
$accessKey | string | Access key you got from baidu cloud platform |
$secretKey | string | Secret key you got from baidu cloud platform |
return | array | false | Returns access token info if success, or false if failed |
public getAuthorizeUrl ( string $responseType = 'code', string $scope = '', string $state = '', string $display = 'popup' ) : string | ||
$responseType | string | Response type, 'code' or 'token' |
$scope | string | blank space separated list of requested extended perms |
$state | string | state parameter |
$display | string | Authorization page style, 'page', 'popup', 'touch' or 'mobile' |
return | string | Page url for authorization granting |
public getLogoutUrl ( string $accessToken, string $next = '' ) : String | ||
$accessToken | string | Access token for current user |
$next | string | Url to go to after a successful logout |
return | String | The URL for the logout flow |
public getRedirectUri ( ) : string | ||
return | string |
public makeAccessTokenRequest ( array $params ) : mixed | ||
$params | array | oauth request parameters |
return | mixed | returns access token info if success, or false if failed |
public setRedirectUri ( $redirectUri ) : BaiduOAuth2 | ||
$redirectUri | Where to redirect after user authorization. | |
return | BaiduOAuth2 |
public static $BD_OAUTH2_ENDPOINTS |