You appear to be a bot. Output may be restricted
Description
Usage
Client::getUserInfo( $accessToken );
Parameters
- $accessToken
- ( mixed ) required –
Returns
void
Source
File name: easy-digital-downloads/includes/gateways/libs/amazon/Client.php
Lines:
1 to 34 of 34
public function getUserInfo($accessToken) { // Get the correct Profile Endpoint URL based off the country/region provided in the config['region'] $this->profileEndpointUrl(); if (empty($accessToken)) { throw new \InvalidArgumentException('Access Token is a required parameter and is not set'); } // To make sure double encoding doesn't occur decode first and encode again. $accessToken = urldecode($accessToken); $url = $this->profileEndpoint . '/auth/o2/tokeninfo?access_token=' . urlEncode($accessToken); $httpCurlRequest = new HttpCurl(); $response = $httpCurlRequest->httpGet($url); $data = json_decode($response); if ($data->aud != $this->config['client_id']) { // The access token does not belong to us throw new \Exception('The Access token entered is incorrect'); } // Exchange the access token for user profile $url = $this->profileEndpoint . '/user/profile'; $httpCurlRequest = new HttpCurl(); $httpCurlRequest->setAccessToken($accessToken); $httpCurlRequest->setHttpHeader(true); $response = $httpCurlRequest->httpGet($url); $userInfo = json_decode($response, true); return $userInfo; }