PHP 클래스 OAuth2Handler, googleads-php-lib

파일 보기 프로젝트 열기: googleads/googleads-php-lib 1 사용 예제들

공개 메소드들

메소드 설명
CanRefreshAccessToken ( array $credentials ) : boolean Determines if the access token can be refreshed.
FormatCredentialsForHeader ( array $credentials ) : string Formats OAuth2 credentials for use in an HTTP header.
FormatCredentialsForUrl ( array $credentials ) : string Formats OAuth2 credentials for use in a URL.
GetAccessToken ( array $credentials, string $code, string $redirectUri = null ) : array Gets the access token for an authorized request token.
GetAuthorizationUrl ( array $credentials, string $redirectUri = null, boolean $offline = null, array $params = null ) : string Gets the authorization URL to redirect to.
GetOrRefreshAccessToken ( array $credentials ) : array Get the valid access token or the token if needed and possible.
GetScopes ( ) : array Gets OAuth2 scopes.
IsAccessTokenExpiring ( array $credentials ) : boolean Tests if the access token is about to expire or has expired.
IsAccessTokenValid ( array $credentials ) : boolean Determines if the access token is still valid. If expiry information isn't available then this function will assume it is.
RefreshAccessToken ( array $credentials ) : array Refreshes the access token.
SetScopes ( $scopes ) Sets OAuth2 scopes.
ShouldRefreshAccessToken ( array $credentials ) : boolean Determines if the access token should be refreshed.
__construct ( array $scopes = null )

보호된 메소드들

메소드 설명
GetAccessEndpoint ( array $params = null ) : string Gets the access endpoint using the given server and parameters.
GetAuthorizeEndpoint ( array $params = null ) : string Gets the authorization endpoint using the given server and parameters.

비공개 메소드들

메소드 설명
GetEndpoint ( string $endpoint, array $params = null ) : string Gets an endpoint using the given server and parameters.
GetExpiryTimestamp ( array $credentials ) : integer | boolean Get the expiry of a given credential, or false if none is found.

메소드 상세

CanRefreshAccessToken() 공개 메소드

Determines if the access token can be refreshed.
public CanRefreshAccessToken ( array $credentials ) : boolean
$credentials array the credentials
리턴 boolean true if the credentials can be refreshed

FormatCredentialsForHeader() 공개 메소드

For example: Bearer token
public FormatCredentialsForHeader ( array $credentials ) : string
$credentials array the OAuth2 credentials
리턴 string the credentials formatted for use in an HTTP header

FormatCredentialsForUrl() 공개 메소드

For example: access_token=token.
public FormatCredentialsForUrl ( array $credentials ) : string
$credentials array the OAuth2 credentials
리턴 string the credentials formatted for use in a URL

GetAccessEndpoint() 보호된 메소드

Gets the access endpoint using the given server and parameters.
protected GetAccessEndpoint ( array $params = null ) : string
$params array the parameters to include in the endpoint
리턴 string the access endpoint

GetAccessToken() 추상적인 공개 메소드

Gets the access token for an authorized request token.
또한 보기: https://developers.google.com/accounts/docs/OAuth2WebServer#handlingtheresponse
abstract public GetAccessToken ( array $credentials, string $code, string $redirectUri = null ) : array
$credentials array the credentials, including client_id and client_secret
$code string the authorization code returned in the response
$redirectUri string optional callback URL
리턴 array the credentials passed in plus access_token, expires_in, timestamp and optionally refresh_token if offline mode was requested

GetAuthorizationUrl() 공개 메소드

Gets the authorization URL to redirect to.
또한 보기: https://developers.google.com/accounts/docs/OAuth2WebServer#formingtheurl
public GetAuthorizationUrl ( array $credentials, string $redirectUri = null, boolean $offline = null, array $params = null ) : string
$credentials array the credentials, including client_id
$redirectUri string optional callback URL
$offline boolean whether or not to request offline access (aka a refresh token), false by default
$params array optional array of additional parameters to include in the URL
리턴 string an authorization URL to redirect the user to

GetAuthorizeEndpoint() 보호된 메소드

Gets the authorization endpoint using the given server and parameters.
protected GetAuthorizeEndpoint ( array $params = null ) : string
$params array the parameters to include in the endpoint
리턴 string the authorization endpoint

GetOrRefreshAccessToken() 공개 메소드

Get the valid access token or the token if needed and possible.
public GetOrRefreshAccessToken ( array $credentials ) : array
$credentials array the credentials, including client_id and client_secret
리턴 array the credentials passed in plus any refreshed credentials if they were refreshed

GetScopes() 공개 메소드

Gets OAuth2 scopes.
public GetScopes ( ) : array
리턴 array the list of OAuth2 scopes

IsAccessTokenExpiring() 공개 메소드

Tests if the access token is about to expire or has expired.
public IsAccessTokenExpiring ( array $credentials ) : boolean
$credentials array the credentials, including access_token, timestamp and expires_in
리턴 boolean true if the token has expired

IsAccessTokenValid() 공개 메소드

Determines if the access token is still valid. If expiry information isn't available then this function will assume it is.
public IsAccessTokenValid ( array $credentials ) : boolean
$credentials array the credentials, including access_token, timestamp and expires_in
리턴 boolean true if the access token is valid or if expiring information isn't available

RefreshAccessToken() 추상적인 공개 메소드

Refreshes the access token.
또한 보기: https://developers.google.com/accounts/docs/OAuth2WebServer#offline
abstract public RefreshAccessToken ( array $credentials ) : array
$credentials array the credentials, including the client_id, client_secret, refresh_token
리턴 array the credentials

SetScopes() 공개 메소드

Sets OAuth2 scopes.
public SetScopes ( $scopes )

ShouldRefreshAccessToken() 공개 메소드

Determines if the access token should be refreshed.
public ShouldRefreshAccessToken ( array $credentials ) : boolean
$credentials array the credentials, including client_id and client_secret
리턴 boolean true if the Access Token should be refreshed

__construct() 공개 메소드

public __construct ( array $scopes = null )
$scopes array optional, Google API scopes this handler should use