Property | Type | Description | |
---|---|---|---|
$clientId | string | The client_id of the app or access_key of the developer. | |
$clientSecret | string | The client_secret of the app or secret_key of the developer. | |
$oauth2 | BaiduOAuth2 | ||
$redirectUri | string | Redirect uri of the app, where we will redirect to after user authorization. | |
$session | array | User session info. | |
$state | string | ||
$store | BaiduStore | Storage for the user session related datas, like state, authorization code, access token and so on. |
Method | Description | |
---|---|---|
__construct ( string $clientId, string $clientSecret, string $redirectUri, BaiduStore $store = null ) | Constructor | |
getAccessToken ( ) : string | false | Get access token for openapi calls. | |
getBaiduApiClientService ( ) : BaiduApiClient | Get an instance of BaiduApiClient class. | |
getBaiduOAuth2Service ( ) : BaiduOAuth2 | Get an instance of BaiduOAuth2 class. | |
getLoggedInUser ( ) : uint | false | Get currently logged in user's uid. | |
getLoginUrl ( string $scope = '', string $display = 'page' ) : string | Get a Login URL for use with redirects. By default, full page redirect is assumed. If you are using the generated URL with a window.open() call in JavaScript, you can pass in display=popup as part of the $params. | |
getLogoutUrl ( string $next ) : string | Get the Logout URL suitable for use with redirects. | |
getRefreshToken ( ) : string | false | Get refresh token. | |
getSession ( ) : array | Get user session info. | |
setSession ( array $session ) : Baidu | Set user session. |
Method | Description | |
---|---|---|
doGetSession ( ) : array | false | Get session info from Baidu server or from the store in app server side. | |
establishCSRFTokenState ( ) | Lays down a CSRF state token for this process. | |
getCode ( ) : mixed | Get the authorization code from the query parameters, if it exists, otherwise return false to signal no authorization code was discoverable. | |
getUser ( ) : array | false | Get current user's uid and uname. | |
setStore ( BaiduStore $store ) : Baidu | Set the session data storage instance. |
public __construct ( string $clientId, string $clientSecret, string $redirectUri, BaiduStore $store = null ) | ||
$clientId | string | The client_id of the app or access_key of the developer. |
$clientSecret | string | The client_secret of the app or secret_key of the developer. |
$redirectUri | string | Redirect uri of the app. |
$store | BaiduStore | Storage for the user session related datas. |
protected doGetSession ( ) : array | false | ||
return | array | false |
protected establishCSRFTokenState ( ) |
public getAccessToken ( ) : string | false | ||
return | string | false | Returns access token if user has authorized the app, or false if not. |
public getBaiduApiClientService ( ) : BaiduApiClient | ||
return | BaiduApiClient |
public getBaiduOAuth2Service ( ) : BaiduOAuth2 | ||
return | BaiduOAuth2 |
public getLoggedInUser ( ) : uint | false | ||
return | uint | false | Return uid of the loggedin user, or return false if user isn't loggedin. |
public getLogoutUrl ( string $next ) : string | ||
$next | string | Url to go to after a successful logout. |
return | string |
public getRefreshToken ( ) : string | false | ||
return | string | false | Returns refresh token if app has, or false if not. |
public setSession ( array $session ) : Baidu | ||
$session | array | User session info. |
return | Baidu |
protected setStore ( BaiduStore $store ) : Baidu | ||
$store | BaiduStore | |
return | Baidu |
protected string $clientId | ||
return | string |
protected string $clientSecret | ||
return | string |
protected string $redirectUri | ||
return | string |