File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ $oauth = new Herbert\Envato\Auth\OAuth([
9292]);
9393
9494// Get the token (returns null if unavailable)
95- $token = $oauth->token ;
95+ $token = $oauth->auth ;
9696
9797// Redirect the user if they're not authorized yet
9898if (!$token) {
@@ -128,7 +128,7 @@ if (isset($_SESSION['oauth_session'])) {
128128
129129// No saved session, so let's start a new one
130130else {
131- if ($oauth->token ) {
131+ if ($oauth->auth ) {
132132 // Save the OAuth session
133133 $_SESSION['oauth_session'] = $oauth->session;
134134 }
@@ -140,7 +140,7 @@ else {
140140}
141141
142142// Create the client
143- $client = new Herbert\EnvatoClient($oauth->token );
143+ $client = new Herbert\EnvatoClient($oauth->auth );
144144```
145145
146146- The ` $oauth->session ` member will contain a JSON string with data for the current authorization.
Original file line number Diff line number Diff line change @@ -176,8 +176,12 @@ public function __get($property) {
176176 if ($ property == 'auth ' ) {
177177 // Only if we've just returned from authorization
178178 if (isset ($ _GET ['code ' ])) {
179- return ($ this ->generatedToken ) ?: $ this ->generateToken (trim ($ _GET ['code ' ]));
179+ if (!$ this ->generatedToken ) {
180+ $ this ->generateToken (trim ($ _GET ['code ' ]));
181+ }
180182 }
183+
184+ return $ this ->generatedToken ;
181185 }
182186
183187 // Handle session requests
You can’t perform that action at this time.
0 commit comments