PHP 클래스 BaiduOAuth2, thinksns

저자: zhujianting([email protected])
파일 보기 프로젝트 열기: medz/thinksns-4 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$BD_OAUTH2_ENDPOINTS Endpoints for Baidu OAuth2.0.

보호된 프로퍼티들

프로퍼티 타입 설명
$clientId
$clientSecret
$redirectUri

공개 메소드들

메소드 설명
__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.

메소드 상세

__construct() 공개 메소드

Constructor
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.

getAccessTokenByAuthorizationCode() 공개 메소드

Get access token ifno by authorization code.
public getAccessTokenByAuthorizationCode ( string $code ) : array | false
$code string Authorization code
리턴 array | false returns access token info if success, or false if failed

getAccessTokenByClientCredentials() 공개 메소드

Get access token info by client credentials.
public getAccessTokenByClientCredentials ( string $scope = '' ) : array | false
$scope string Extend permissions delimited by blank space
리턴 array | false returns access token info if success, or false if failed.

getAccessTokenByDeveloperCredentials() 공개 메소드

Get access token info by developer credentials
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
리턴 array | false Returns access token info if success, or false if failed

getAccessTokenByRefreshToken() 공개 메소드

Refresh access token by refresh token.
public getAccessTokenByRefreshToken ( string $refreshToken, string $scope = '' ) : array | false
$refreshToken string The refresh token
$scope string Extend permissions delimited by blank space
리턴 array | false returns access token info if success, or false if failed.

getAuthorizeUrl() 공개 메소드

Get baidu oauth2's authorization granting url.
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'
리턴 string Page url for authorization granting

getLogoutUrl() 공개 메소드

Get a Logout URL suitable for use with redirects.
public getLogoutUrl ( string $accessToken, string $next = '' ) : String
$accessToken string Access token for current user
$next string Url to go to after a successful logout
리턴 String The URL for the logout flow

getRedirectUri() 공개 메소드

Get the redirect uri for the app.
public getRedirectUri ( ) : string
리턴 string

makeAccessTokenRequest() 공개 메소드

The parameters: - client_id: The client identifier, just use api key - response_type: 'token' or 'code' - redirect_uri: the url to go to after a successful login - scope: The scope of the access request expressed as a list of space-delimited, case sensitive strings. - state: An opaque value used by the client to maintain state between the request and callback. - display: login page style, 'page', 'popup', 'touch' or 'mobile'
public makeAccessTokenRequest ( array $params ) : mixed
$params array oauth request parameters
리턴 mixed returns access token info if success, or false if failed

setRedirectUri() 공개 메소드

Set the redirect uri for the app.
public setRedirectUri ( $redirectUri ) : BaiduOAuth2
$redirectUri Where to redirect after user authorization.
리턴 BaiduOAuth2

프로퍼티 상세

$BD_OAUTH2_ENDPOINTS 공개적으로 정적으로 프로퍼티

Endpoints for Baidu OAuth2.0.
public static $BD_OAUTH2_ENDPOINTS

$clientId 보호되어 있는 프로퍼티

protected $clientId

$clientSecret 보호되어 있는 프로퍼티

protected $clientSecret

$redirectUri 보호되어 있는 프로퍼티

protected $redirectUri