src/SecucardConnect/Auth/OauthProvider.php
public function appyAuthorization(RequestInterface $request, array $options = null)
    {
        // Only sign requests using "auth"="oauth"
        // IMPORTANT: you have to create special auth client (GuzzleHttp\Client) if you want to get all the request authorized
        if (!isset($options['auth']) || $options['auth'] != 'oauth') {
            return $request;
        }

        // get Access token for current request
        $accessToken = $this->getAccessToken();
        if (is_string($accessToken)) {
            return $request->withHeader('Authorization', 'Bearer ' . $accessToken);
        } else {
            throw new ClientError('Authentication error, invalid on no access token data returned.');
        }
    }
public function appyAuthorization(RequestInterface $request, array $options = null)
    {
        // Only sign requests using "auth"="oauth"
        // IMPORTANT: you have to create special auth client (GuzzleHttp\Client) if you want to get all the request authorized
        if (!isset($options['auth']) || $options['auth'] != 'oauth') {
            return $request;
        }

        // get Access token for current request
        $accessToken = $this->getAccessToken();
        if (is_string($accessToken)) {
            return $request->withHeader('Authorization', 'Bearer ' . $accessToken);
        } else {
            throw new ClientError('Authentication error, invalid on no access token data returned.');
        }
    }
public function appyAuthorization ( RequestInterface $ request , array $ options = null ) { // Only sign requests using "auth"="oauth" // IMPORTANT: you have to create special auth client (GuzzleHttp\Client) if you want to get all the request authorized if ( ! isset ( $ options [ 'auth' ] ) || $ options [ 'auth' ] != 'oauth' ) { return $ request ; } // get Access token for current request $ accessToken = $ this -> getAccessToken ( ) ; if ( is_string ( $ accessToken ) ) { return $ request -> withHeader ( 'Authorization' , 'Bearer ' . $ accessToken ) ; } else { throw new ClientError ( 'Authentication error, invalid on no access token data returned.' ) ; } }
Adds the authorization header if an access token was found
@param RequestInterface $request
@param array $options
@return RequestInterface If the access token could not properly set to the request.
@throws ClientError
@throws ApiError
@throws AuthError
Adds the authorization header if an access token was found