File tree 7 files changed +35
-15
lines changed
7 files changed +35
-15
lines changed Original file line number Diff line number Diff line change 8
8
* @license MIT
9
9
*/
10
10
11
- use chillerlan \HTTP \Utils \MessageUtil ;
12
11
use chillerlan \OAuth \Providers \Imgur ;
13
12
14
13
$ ENVVAR ??= 'IMGUR ' ;
46
45
}
47
46
// step 4: verify the token and use the API
48
47
elseif (isset ($ _GET ['granted ' ]) && $ _GET ['granted ' ] === $ name ){
49
- echo '<pre> ' .print_r (MessageUtil:: decodeJSON ( $ provider ->me () ), true ).'</pre> ' .
48
+ echo '<pre> ' .print_r ($ provider ->me (), true ).'</pre> ' .
50
49
'<textarea cols="120" rows="3" onclick="this.select();"> ' .
51
50
$ storage ->getAccessToken ($ name )->toJSON ().
52
51
'</textarea> ' ;
Original file line number Diff line number Diff line change 8
8
* @license MIT
9
9
*/
10
10
11
- use chillerlan \HTTP \Utils \MessageUtil ;
12
11
use chillerlan \OAuth \Providers \LastFM ;
13
12
14
13
$ ENVVAR ??= 'LASTFM ' ;
38
37
}
39
38
// step 4: verify the token and use the API
40
39
elseif (isset ($ _GET ['granted ' ]) && $ _GET ['granted ' ] === $ name ){
41
- echo '<pre> ' .print_r (MessageUtil:: decodeJSON ( $ provider ->me () ), true ).'</pre> ' .
40
+ echo '<pre> ' .print_r ($ provider ->me (), true ).'</pre> ' .
42
41
'<textarea cols="120" rows="3" onclick="this.select();"> ' .
43
42
$ provider ->getAccessTokenFromStorage ()->toJSON ().
44
43
'</textarea> ' ;
Original file line number Diff line number Diff line change 8
8
* @license MIT
9
9
*/
10
10
11
- use chillerlan \HTTP \Utils \MessageUtil ;
12
11
use chillerlan \OAuth \Providers \MailChimp ;
13
12
14
13
$ ENVVAR ??= 'MAILCHIMP ' ;
44
43
}
45
44
// step 4: verify the token and use the API
46
45
elseif (isset ($ _GET ['granted ' ]) && $ _GET ['granted ' ] === $ name ){
47
- echo '<pre> ' .print_r (MessageUtil:: decodeJSON ( $ provider ->me () ), true ).'</pre> ' .
46
+ echo '<pre> ' .print_r ($ provider ->me (), true ).'</pre> ' .
48
47
'<textarea cols="120" rows="3" onclick="this.select();"> ' .
49
48
$ provider ->getAccessTokenFromStorage ()->toJSON ().
50
49
'</textarea> ' ;
Original file line number Diff line number Diff line change 8
8
* @license MIT
9
9
*/
10
10
11
- use chillerlan \HTTP \Utils \MessageUtil ;
12
-
13
11
/**
14
12
* @var \chillerlan\OAuth\Core\OAuth1Interface $provider
15
13
* @var array|null $PARAMS
32
30
}
33
31
// step 4: verify the token and use the API
34
32
elseif (isset ($ _GET ['granted ' ]) && $ _GET ['granted ' ] === $ name ){
35
- echo '<pre> ' .print_r (MessageUtil:: decodeJSON ( $ provider ->me () ), true ).'</pre> ' .
33
+ echo '<pre> ' .print_r ($ provider ->me (), true ).'</pre> ' .
36
34
'<textarea cols="120" rows="3" onclick="this.select();"> ' .
37
35
$ provider ->getAccessTokenFromStorage ()->toJSON ().
38
36
'</textarea> ' ;
Original file line number Diff line number Diff line change 8
8
* @license MIT
9
9
*/
10
10
11
- use chillerlan \HTTP \Utils \MessageUtil ;
12
-
13
11
/**
14
12
* @var \chillerlan\OAuth\Core\OAuth2Interface $provider
15
13
* @var array|null $PARAMS
33
31
}
34
32
// step 4: verify the token and use the API
35
33
elseif (isset ($ _GET ['granted ' ]) && $ _GET ['granted ' ] === $ name ){
36
- echo '<pre> ' .print_r (MessageUtil:: decodeJSON ( $ provider ->me () ), true ).'</pre> ' .
34
+ echo '<pre> ' .print_r ($ provider ->me (), true ).'</pre> ' .
37
35
'<textarea cols="120" rows="3" onclick="this.select();"> ' .
38
36
$ provider ->getAccessTokenFromStorage ()->toJSON ().
39
37
'</textarea> ' ;
Original file line number Diff line number Diff line change 8
8
* @license MIT
9
9
*/
10
10
11
- use chillerlan \HTTP \Utils \MessageUtil ;
12
-
13
11
/**
14
12
* @var \chillerlan\OAuth\Core\OAuth2Interface $provider
15
13
* @var array|null $PARAMS
33
31
}
34
32
// step 4: verify the token and use the API
35
33
elseif (isset ($ _GET ['granted ' ]) && $ _GET ['granted ' ] === $ name ){
36
- echo '<pre> ' .print_r (MessageUtil:: decodeJSON ( $ provider ->me () ), true ).'</pre> ' .
34
+ echo '<pre> ' .print_r ($ provider ->me (), true ).'</pre> ' .
37
35
'<textarea cols="120" rows="3" onclick="this.select();"> ' .
38
36
$ provider ->getAccessTokenFromStorage ()->toJSON ().
39
37
'</textarea> ' ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * OAuth test entry point
4
+ *
5
+ * @created 22.03.2024
6
+ * @author smiley <smiley@chillerlan.net>
7
+ * @copyright 2024 smiley
8
+ * @license MIT
9
+ */
10
+
11
+ // use this with caution only in case something goes terribly wrong
12
+ #error_reporting(E_ALL&~E_DEPRECATED);
13
+ #ini_set('display_errors', 1);
14
+
15
+ // the path to your project's autoloader, e.g. "/var/www/vendor/autoload.php"
16
+ $ AUTOLOADER = __DIR__ .'/../vendor/autoload.php ' ;
17
+ // the path to your config directory (writable, 0777), e.g. "/home/web-user/.oauth-config"
18
+ $ CFGDIR = __DIR__ .'/../.config/ ' ;
19
+ // the name of the .env file
20
+ $ ENVFILE = '.env ' ;
21
+ // an optional prefix for the provider variables in the .env
22
+ $ ENVVAR = null ;
23
+ // optional scopes for OAuth2 providers
24
+ $ SCOPES = null ;
25
+
26
+ require_once __DIR__ .'/../examples/get-token/GitHub.php ' ;
27
+
28
+
29
+
You can’t perform that action at this time.
0 commit comments