PHP Class Webiny\Component\OAuth2\OAuth2

This component is used for communication with OAuth2 servers like Facebook Graph API.
Inheritance: use trait Webiny\Component\StdLib\ComponentTrait
Exibir arquivo Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
__construct ( AbstractOAuth2 $instance ) Base constructor.
getAccessToken ( ) : string Get access token.
getAccessTokenName ( ) : string Returns the name of access token param. Its usually either 'access_token' or 'token' based on the OAuth2 server.
getAuthenticationUrl ( ) : string Returns the authentication url.
getCertificate ( ) : string Returns the path to certificate.
getClientId ( ) : string Get client id.
getClientSecret ( ) : string Get client secret.
getRedirectURI ( ) : string Get the defined redirect URI.
getScope ( ) : string Get the defined scope.
getState ( ) : string Get the state parameter.
request ( ) : AbstractServer
requestAccessToken ( ) : string Requests the access token from the OAuth server.
setAccessToken ( string $accessToken ) : void Set the access token.
setCertificate ( string $pathToCertificate ) : void Set the certificate used by OAuth2 requests.
setScope ( string $scope ) : void Set the request scope.
setState ( string $state ) : void. Set the state parameter.

Private Methods

Method Description
processUrl ( string $url ) : string Replaces the url variables with real data.

Method Details

__construct() public method

NOTE: Use OAuth2Loader::getInstance method to get an OAuth2 instance.
public __construct ( AbstractOAuth2 $instance )
$instance Webiny\Component\OAuth2\Bridge\AbstractOAuth2

getAccessToken() public method

Get access token.
public getAccessToken ( ) : string
return string Access token.

getAccessTokenName() public method

Returns the name of access token param. Its usually either 'access_token' or 'token' based on the OAuth2 server.
public getAccessTokenName ( ) : string
return string

getAuthenticationUrl() public method

Returns the authentication url.
public getAuthenticationUrl ( ) : string
return string Authentication url

getCertificate() public method

Returns the path to certificate.
public getCertificate ( ) : string
return string Path to certificate.

getClientId() public method

Get client id.
public getClientId ( ) : string
return string Client id.

getClientSecret() public method

Get client secret.
public getClientSecret ( ) : string
return string Client secret.

getRedirectURI() public method

Get the defined redirect URI.
public getRedirectURI ( ) : string
return string Redirect URI.

getScope() public method

Get the defined scope.
public getScope ( ) : string
return string A comma separated list of parameters.

getState() public method

Get the state parameter.
public getState ( ) : string
return string State parameter

request() public method

public request ( ) : AbstractServer
return AbstractServer

requestAccessToken() public method

You can call this method only on the OAuth redirect_uri page or else the request will fail.
public requestAccessToken ( ) : string
return string Access token.

setAccessToken() public method

Set the access token.
public setAccessToken ( string $accessToken ) : void
$accessToken string Access token.
return void

setCertificate() public method

Set the certificate used by OAuth2 requests.
public setCertificate ( string $pathToCertificate ) : void
$pathToCertificate string Absolute path to the certificate file.
return void

setScope() public method

Set the request scope.
public setScope ( string $scope ) : void
$scope string A comma-separated list of parameters. Example: email,extender_permissions
return void

setState() public method

Set the state parameter.
public setState ( string $state ) : void.
$state string State name.
return void.