File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 99 */
1010declare (strict_types=1 );
1111
12+ use chillerlan \OAuth \Core \UserInfo ;
13+
1214/**
1315 * @var \chillerlan\OAuth\Core\OAuth1Interface $provider
1416 * @var \OAuthExampleProviderFactory $factory
3638 // use the file storage from now on
3739 $ provider ->setStorage ($ factory ->getFileStorage ());
3840
39- $ me = print_r ($ provider ->me (), true );
41+ if ($ provider instanceof UserInfo){
42+ printf ('<pre>%s</pre> ' , print_r ($ provider ->me (), true ));
43+ }
44+
4045 $ tokenJSON = $ provider ->getAccessTokenFromStorage ()->toJSON ();
4146
42- printf ('<pre>%s</pre>< textarea cols="120" rows="5" onclick="this.select();">%s</textarea> ' , $ me , $ tokenJSON );
47+ printf ('<textarea cols="120" rows="5" onclick="this.select();">%s</textarea> ' , $ tokenJSON );
4348}
4449// step 1 (optional): display a login link
4550else {
Original file line number Diff line number Diff line change 99 */
1010declare (strict_types=1 );
1111
12- use chillerlan \OAuth \Core \CSRFToken ;
12+ use chillerlan \OAuth \Core \{ CSRFToken , UserInfo } ;
1313
1414/**
1515 * @var \chillerlan\OAuth\Core\OAuth2Interface $provider
4545 // use the file storage from now on
4646 $ provider ->setStorage ($ factory ->getFileStorage ());
4747
48- $ me = print_r ($ provider ->me (), true );
48+ if ($ provider instanceof UserInfo){
49+ printf ('<pre>%s</pre> ' , print_r ($ provider ->me (), true ));
50+ }
51+
4952 $ tokenJSON = $ provider ->getAccessTokenFromStorage ()->toJSON ();
5053
51- printf ('<pre>%s</pre>< textarea cols="120" rows="5" onclick="this.select();">%s</textarea> ' , $ me , $ tokenJSON );
54+ printf ('<textarea cols="120" rows="5" onclick="this.select();">%s</textarea> ' , $ tokenJSON );
5255}
5356// step 1 (optional): display a login link
5457else {
You can’t perform that action at this time.
0 commit comments