Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking Permission Scopes After Authentication #35

Open
teraxis opened this issue Apr 28, 2018 · 0 comments
Open

Checking Permission Scopes After Authentication #35

teraxis opened this issue Apr 28, 2018 · 0 comments

Comments

@teraxis
Copy link

teraxis commented Apr 28, 2018

Hi! I decide to check API permission scope. On this page (https://www.etsy.com/developers/documentation/getting_started/oauth#section_checking_permission_scopes_after_authentication) you can get function to do this.
I add such function after function setDebug in EtsyClient.php

	public function getScopes()
	{
        $data = $this->oauth->fetch($this->base_url . "/oauth/scopes", null, OAUTH_HTTP_METHOD_GET);
        $json = $this->oauth->getLastResponse();
        echo '<pre>';
        print_r(json_decode($json, true));
	}

And run it by such code

$this->auth = new \Etsy\EtsyClient($auth['consumer_key'], $auth['consumer_secret']);
$this->auth->authorize($auth['access_token'], $auth['access_token_secret']);
$result = $this->auth->getScopes(true);

In result I got answer

Array
(
    [count] => 18
    [results] => Array
        (
            [0] => email_r
            [1] => listings_r
            [2] => listings_w
            [3] => listings_d
            [4] => transactions_r
            [5] => transactions_w
            [6] => billing_r
            [7] => profile_r
            [8] => profile_w
            [9] => address_r
            [10] => address_w
            [11] => favorites_rw
            [12] => shops_rw
            [13] => cart_rw
            [14] => recommend_rw
            [15] => feedback_r
            [16] => treasury_r
            [17] => treasury_w
        )

    [params] => 
    [type] => ArrayString
    [pagination] => Array
        (
        )

)

Maybe it will be useful to others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant