TijsVerkoyen\Dropbox\Dropbox::oAuthRequestToken PHP Метод

oAuthRequestToken() публичный Метод

This method corresponds to Obtaining an Unauthorized Request Token in the OAuth Core 1.0 specification. A request token and the corresponding request token secret, URL-encoded. This token/secret pair is meant to be used with /oauth/access_token to complete the authentication process and cannot be used for any other API calls. See Service Provider Issues an Unauthorized Request Token in the OAuth Core 1.0 specification for additional discussion of the values returned when fetching a request token.
public oAuthRequestToken ( ) : array
Результат array
    public function oAuthRequestToken()
    {
        // make the call
        $response = $this->doOAuthCall('1/oauth/request_token', null, 'POST', false);
        // process response
        $response = (array) explode('&', $response);
        $return = array();
        // loop chunks
        foreach ($response as $chunk) {
            // split again
            $chunks = explode('=', $chunk, 2);
            // store return
            if (count($chunks) == 2) {
                $return[$chunks[0]] = $chunks[1];
            }
        }
        // return
        return $return;
    }

Usage Example

Пример #1
0
 /**
  * Tests Dropbox->oAuthRequestToken()
  */
 public function testOAuthRequestToken()
 {
     $this->dropbox->setOAuthToken('');
     $this->dropbox->setOAuthTokenSecret('');
     $response = $this->dropbox->oAuthRequestToken();
     $this->assertArrayHasKey('oauth_token_secret', $response);
     $this->assertArrayHasKey('oauth_token', $response);
 }