8000 fixed several bugs in the OAuth class · oauth-io/sdk-php@9badc3c · GitHub
[go: up one dir, main page]

Skip to content

Commit 9badc3c

Browse files
committed
fixed several bugs in the OAuth class
1 parent 21cdc13 commit 9badc3c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/OAuth_io/OAuth.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,23 @@ public function auth($provider, $options = array()) {
108108
'method' => 'POST',
109109
'url' => $this->injector->config['oauthd_url'] . '/auth/access_token',
110110
'body' => http_build_query(array(
111-
'code' => $code,
111+
'code' => $options['code'],
112112
'key' => $this->injector->config['app_key'],
113113
'secret' => $this->injector->config['app_secret']
114114
)) ,
115115
'headers' => array(
116116
'Content-Type' => 'application/x-www-form-urlencoded'
117117
)
118118
));
119-
$credentials = $response->body;
120-
if (isset($credentials->provider)) {
121-
$this->injector->session['oauthio']['auth'][$credentials->provider] = json_decode(json_encode($credentials) , true);
119+
$credentials = json_decode(json_encode($response->body), true);
120+
121+
if (isset($credentials['provider'])) {
122+
$this->injector->session['oauthio']['auth'][$credentials['provider']] = $credentials;
122123
}
123124
} else if (isset($options['credentials'])) {
124125
$credentials = $options['credentials'];
125126
} else {
126-
$credentials = $this->injector->session['oauthio']['auth']['provider'];
127+
$credentials = $this->injector->session['oauthio']['auth'][$provider];
127128
}
128129
$credentials = $this->refreshCredentials($credentials);
129130
$request = new Request($credentials);

0 commit comments

Comments
 (0)
0