# \[PHP\] fetch\_user() returns HTTP 403 when logging in with other account

**URL:** <https://www.patreondevelopers.com/t/php-fetch-user-returns-http-403-when-logging-in-with-other-account/1850>\
**Category:** Friendly Help\
**Created:** [May 12, 2019, 3:00pm UTC](https://www.patreondevelopers.com/t/php-fetch-user-returns-http-403-when-logging-in-with-other-account/1850 "2019-05-12T15:00:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JasperDL](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@JasperDL](https://www.patreondevelopers.com/u/JasperDL)\
**Post date:** [May 12, 2019, 3:00pm UTC](https://www.patreondevelopers.com/t/php-fetch-user-returns-http-403-when-logging-in-with-other-account/1850/1 "2019-05-12T15:00:28Z")

</div>

Hello,

I’m trying to make a patreon pledge verification system for my game. I’m currently at the stage of obtaining the user information using fetch\_user(). This all works fine if I log in with my creator account. But when I log in with a patron account, the API call returns the following:

```
403 You do not have permission to view OAuth Client with id <client ID, correct>. 

```

Everything before this step, including the OAuth token obtainment seems to run correctly, so I’m a bit at a loss. I do need to point out I am new at web development and PHP, but have quite some experience making video games.

Here’s the code I’m using so far:

```
<?php
  require_once __DIR__.'/vendor/autoload.php';

  use Patreon\API;
  use Patreon\OAuth;

  include 'vars.php'; // Client ID/Secret, redirect URL.

  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'];

    echo nl2br("Access token: $access_token \n Refresh token: $refresh_token \n");

    $api_client = new API($access_token);
    $user_info = $api_client->fetch_user();

    if ($user_info->has('errors'))
    {
      $error = $user_info->get('errors')->get(0);
      $error_a = $error->get('id');
      $error_b = $error->get('status');
      $error_c = $error->get('code');
      $error_d = $error->get('title');
      $error_e = $error->get('detail');
      echo nl2br("$error_a \n $error_b \n $error_c \n $error_d \n $error_e \n");
    }
    else
    {
      $user_data = $user_info->get('data');
      $user_id = $user_data->get('id');
      echo "$user_id";

      $user_pledges = $user_data->relationship('pledges');
      //var_dump($user_pledges->getKeys());
    }
  }
  else
  {
    echo "Error: User denied authorization";
  }
?>

```

I’m using what seems to be version 0.3.1 of the patreon php libraries.

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [May 12, 2019, 3:45pm UTC](https://www.patreondevelopers.com/t/php-fetch-user-returns-http-403-when-logging-in-with-other-account/1850/2 "2019-05-12T15:45:00Z")

</div>

Can you try version 1.0.0 that’s ready to use with API v2 and see if it will just work. You would have to use v2 credentials, of course.

> **[Patreon/patreon-php](https://github.com/Patreon/patreon-php)**
>
> Interact with the Patreon API via OAuth. Contribute to Patreon/patreon-php development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![JasperDL](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@JasperDL](https://www.patreondevelopers.com/u/JasperDL)\
**Post date:** [May 12, 2019, 4:08pm UTC](https://www.patreondevelopers.com/t/php-fetch-user-returns-http-403-when-logging-in-with-other-account/1850/3 "2019-05-12T16:08:23Z")

</div>

Ah yes, I soon found out after posting that 0.3.1 was outdated, yet installed by default by Composer. Fixed it by uninstalling and installing using: `composer require patreon/patreon:dev-master`
