PHP Class AsanaAuth

The use of this class is totally optional and you can use any other oauth implementation if prefered. Copyright 2016 Ajimix Licensed under the Apache License 2.0 Authors: Ajimix [github.com/ajimix], Puchol [https://github.com/puchol] Version: 2.0.0
Afficher le fichier Open project: ajimix/asana-api-php-class Class Usage Examples

Méthodes publiques

Свойство Type Description
$responseCode

Méthodes publiques

Méthode Description
__construct ( string $clientId, string $clientSecret, string $redirectUrl ) Class constructor.
getAccessToken ( string $authCode ) : string Converts an authorization code into an access token via a call to the asana servers.
getAuthorizeUrl ( ) : string Returns the url for the authorization.
getData ( ) : object Decodes the response and returns as an object.
hasError ( ) : boolean Checks for errors in the response.
refreshAccessToken ( string $refreshToken ) : string Ask asana to refresh the token with a new one.

Private Methods

Méthode Description
askAsana ( string $action, string $token ) : string This function communicates with Asana REST API.

Method Details

__construct() public méthode

Class constructor.
public __construct ( string $clientId, string $clientSecret, string $redirectUrl )
$clientId string Client ID given by asana app creator.
$clientSecret string Client secret given by asana app creator.
$redirectUrl string Redirect url, must match the one given in asana app creator.

getAccessToken() public méthode

Converts an authorization code into an access token via a call to the asana servers.
public getAccessToken ( string $authCode ) : string
$authCode string The authorization code provided via asana after the proper authorization.
Résultat string JSON or null.

getAuthorizeUrl() public méthode

Use this url to redirect the user, let the user authorize your application, and then come back to your application with the token.
public getAuthorizeUrl ( ) : string
Résultat string The authorization url.

getData() public méthode

Decodes the response and returns as an object.
public getData ( ) : object
Résultat object or null

hasError() public méthode

Checks for errors in the response.
public hasError ( ) : boolean
Résultat boolean

refreshAccessToken() public méthode

Ask asana to refresh the token with a new one.
public refreshAccessToken ( string $refreshToken ) : string
$refreshToken string The refresh token provided by asana on getting the access token.
Résultat string JSON or null.

Property Details

$responseCode public_oe property

public $responseCode