src/ORCIDService.php
protected function getOAuthToken() {
        # TODO: use session to store the token
        if ($this->client_id and $this->client_secret) {
            $response = $this->httpQuery(
                'POST', 'https://orcid.org/oauth/token',
                [
                    'Accept' => 'application/json',
                    'Content-Type' => 'application/x-www-form-urlencoded'
                ],
                http_build_query([
                  'client_id' => $this->client_id,
                  'client_secret' => $this->client_secret,
                  'scope' => '/read-public',
                  'grant_type' => 'client_credentials',
                ])
            );

            if ($response) {
                return $response->{'access_token'};
            }
        }
    }
protected function getOAuthToken() {
        # TODO: use session to store the token
        if ($this->client_id and $this->client_secret) {
            $response = $this->httpQuery(
                'POST', 'https://orcid.org/oauth/token',
                [
                    'Accept' => 'application/json',
                    'Content-Type' => 'application/x-www-form-urlencoded'
                ],
                http_build_query([
                  'client_id' => $this->client_id,
                  'client_secret' => $this->client_secret,
                  'scope' => '/read-public',
                  'grant_type' => 'client_credentials',
                ])
            );

            if ($response) {
                return $response->{'access_token'};
            }
        }
    }
protected function getOAuthToken ( ) { # TODO: use session to store the token if ( $ this -> client_id and $ this -> client_secret ) { $ response = $ this -> httpQuery ( 'POST' , 'https://orcid.org/oauth/token' , [ 'Accept' => 'application/json' , 'Content-Type' => 'application/x-www-form-urlencoded' ] , http_build_query ( [ 'client_id' => $ this -> client_id , 'client_secret' => $ this -> client_secret , 'scope' => '/read-public' , 'grant_type' => 'client_credentials' , ] ) ) ; if ( $ response ) { return $ response -> { 'access_token' } ; } } }
Get an OAuth access token
Get an OAuth access token