PHP Classes

Error : not possible to access the API call

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How to Implement a PH...  >  All threads  >  Error : not possible to access the...  >  (Un) Subscribe thread alerts  
Subject:Error : not possible to access the...
Summary:This method requires scope authentication not granted.
Messages:5
Author:Sagar Patil
Date:2015-11-02 13:54:24
 

  1. Error : not possible to access the...   Reply   Report abuse  
Picture of Sagar Patil Sagar Patil - 2015-11-02 13:54:24
I am using etsy ,
the example "Log In As Etsy" is working .
for this
$success = $this->client->CallAPI('https://openapi.etsy.com/v2/users/__SELF__','GET',array(), array('FailOnAccessError'=>true), $user);

LOGIN SUCCESSFULL!

but when I use
$success = $this->client->CallAPI('https://openapi.etsy.com/v2/listings','POST',$itemDetails, array('FailOnAccessError'=>true), $user);

gives an error -
it was not possible to access the API call: it was returned an unexpected response status 403 Response: This method requires scope authentication not granted.

I tried with both $this->client->scope = 'email_r%20listings_w'; and
$this->client->scope = 'listings_w';
client_id and client_secret both are set correctly

still getting the same error !!

please help ASAP

  2. Re: Error : not possible to access the...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-11-02 18:14:48 - In reply to message 1 from Sagar Patil
If you need to access an API that requires new permissions, you need to get a new token.

Call the ResetAccessToken function and start the process over, so it is forced to authorize again with the new scope and get a new token.

  3. Re: Error : not possible to access the...   Reply   Report abuse  
Picture of Sagar Patil Sagar Patil - 2015-11-03 07:32:29 - In reply to message 2 from Manuel Lemos
Thanks for the reply Manuel,
It perfectly worked for me .
Thank you .


  4. Re: Error : not possible to access the...   Reply   Report abuse  
Picture of Anurag Bhaskar Anurag Bhaskar - 2015-11-06 07:41:13 - In reply to message 2 from Manuel Lemos
Can you explain it clearly with code then it will be helpful for me.
Please. Its urgent, i am waiting for your response.

  5. Re: Error : not possible to access the...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-11-06 17:42:05 - In reply to message 4 from Anurag Bhaskar
What do you need to be explained?

How to reset an access token? If so, you need to call the ResetAccessToken function to make the class forget the previously retrieved token, so the process can start over with a new token with the right scope permissions.

If the class object is in the $client variable, call it like this:

$client->ResetAccessToken();