File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,13 @@ public function getAccessTokenOptions($method, array $params)
5757 $ accessToken = new AccessToken ($ _SESSION ['accessToken ' ]);
5858}
5959
60+ if (isset ($ _GET ['error ' ])) {
61+ echo "<pre> " ;
62+ var_dump ($ _GET );
63+ echo "</pre> " ;
64+ die ();
65+ }
66+
6067/** @noinspection PhpStatementHasEmptyBodyInspection */
6168if (isset ($ accessToken ) && !$ accessToken ->hasExpired ()) {
6269 // do nothing - the access token is still valid
@@ -73,9 +80,19 @@ public function getAccessTokenOptions($method, array $params)
7380 // Fetch the authorization URL from the provider; this returns the
7481 // urlAuthorize option and generates and applies any necessary parameters
7582 // (e.g. state).
76- $ authorizationUrl = $ provider -> getAuthorizationUrl ( [
83+ $ options = [
7784 'scope ' => $ settings ['oauth2scope ' ]
78- ]);
85+ ];
86+
87+ if (isset ($ settings ['accountId ' ])) {
88+ $ options ['account_token ' ] = $ client ->createAccountToken (
89+ $ settings ['accountId ' ],
90+ $ settings ['clientId ' ],
91+ $ settings ['clientSecret ' ]
92+ );
93+ }
94+
95+ $ authorizationUrl = $ provider ->getAuthorizationUrl ($ options );
7996
8097 // Get the state generated for you and store it to the session.
8198 $ _SESSION ['oauth2state ' ] = $ provider ->getState ();
@@ -100,7 +117,9 @@ public function getAccessTokenOptions($method, array $params)
100117 'code ' => $ _GET ['code ' ]
101118 ]);
102119 } catch (Throwable $ e ) {
120+ echo "<pre> " ;
103121 var_dump ($ e );
122+ echo "</pre> " ;
104123 die ();
105124 }
106125 $ _SESSION ['accessToken ' ] = $ accessToken ->jsonSerialize ();
You can’t perform that action at this time.
0 commit comments