My first steps with patreon-php / I need help

Hello. I have been making my first steps with patreon-php. I just hit a snag and I am looking for some help:
-I have already created my client id and client secret
-I have made my login button
-I have managed to successfully authorize my app thru the patreon authorize screen.
-I have managed to successfully get my access token, expiration date, token type, scope, refresh token, and version.
however, when I try to fetch the user information using the API, I get a 401 error message.
I am a little lost here. Could anybody tell me what I did wrong?
Any pointers would be most appreciated.
Thanks!
I’m including here the code I used, mostly copied from the github ‘log_in_user_via_patreon.php’ example:

<?php
include 'auth/Patreon/API.php';
include 'auth/Patreon/OAuth.php';

use Patreon\API;
use Patreon\OAuth;

$client_id='my client id';
$client_secret='my client secret';

$redirect_uri='https://www.asequentialart.com/myAuthApp.php'; //this is where I house this script

if ( $_GET['code'] != '' ) {

$oauth_client = new OAuth($client_id, $client_secret);

$tokens = $oauth_client->get_tokens($_GET['code'], $redirect_uri);

$access_token = $tokens['access_token'];
$refresh_token = $tokens['refresh_token'];

}
//here if I use print_r($tokens) it shows that I have my access token, refresh token, etc... So it seems to me it works all right up to this point.

$api_client = new API($access_token);
$patron_response = $api_client->fetch_user();
//if I try to echo $patron_response , it gives me the 401 error message

Never mind, I think it was the API version. My original client was API v1. I switched to API v2 and now I am receiving the proper array with the user information.

1 Like

yes, PHP lib’s latest version is for V2. Because v1 is slated for deprecation in foreseeable future, new version was made just for v2.