Error when using OAuth2; 401 Unauthorized

#1

@edit
Solved, was missing auth

Hi, I am having a problem with OAuth2.
After the SSO redirects to my “callback” page with the code param, when i use getAcessToken with ‘authorization_code’ as grant_type and params: [ ‘code’ => $_GET[‘code’], ‘redirect_uri’ => ‘myapp.com/thispage.php’ ] the result returns ‘Error 401 Unauthorized’.

My client_id and secret are correct, not sure about the rest of the code:

const AUTHORIZATION_ENDPOINT = 'https://api.faceit.com/auth/v1/api/authorize';
const TOKEN_ENDPOINT         = 'https://api.faceit.com/auth/v1/oauth/token';

$params = array('code' => $_GET['code'], 'redirect_uri' => REDIRECT_URI);
$response = $client->getAccessToken(TOKEN_ENDPOINT, 'authorization_code', $params);

print_r($response); //401 here

parse_str($response['result'], $info);
$client->setAccessToken($info['access_token']);
$response = $client->fetch('https://api.faceit.com/auth/v1/resources/userinfo');
var_dump($response, $response['result']);
closed #2