Skip to content

Commit 6632967

Browse files
better uri examples
1 parent da18068 commit 6632967

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

Diff for: passport.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ php artisan passport:client
285285
If you would like to allow multiple redirect URIs for your client, you may specify them using a comma-delimited list when prompted for the URI by the `passport:client` command. Any URIs which contain commas should be URI encoded:
286286

287287
```shell
288-
http://example.com/callback,http://examplefoo.com/callback
288+
https://third-party-app.com/callback,https://example.com/oauth/redirect
289289
```
290290

291291
<a name="managing-third-party-clients"></a>
@@ -303,7 +303,7 @@ $user = User::find($userId);
303303
$client = app(ClientRepository::class)->createAuthorizationCodeGrantClient(
304304
user: $user,
305305
name: 'Example App',
306-
redirectUris: ['https://example.com/callback'],
306+
redirectUris: ['https://third-party-app.com/callback'],
307307
confidential: false,
308308
enableDeviceFlow: true
309309
);
@@ -331,14 +331,14 @@ Route::get('/redirect', function (Request $request) {
331331

332332
$query = http_build_query([
333333
'client_id' => 'your-client-id',
334-
'redirect_uri' => 'http://third-party-app.com/callback',
334+
'redirect_uri' => 'https://third-party-app.com/callback',
335335
'response_type' => 'code',
336336
'scope' => 'user:read orders:create',
337337
'state' => $state,
338338
// 'prompt' => '', // "none", "consent", or "login"
339339
]);
340340

341-
return redirect('http://passport-app.test/oauth/authorize?'.$query);
341+
return redirect('https://passport-app.test/oauth/authorize?'.$query);
342342
});
343343
```
344344

@@ -398,11 +398,11 @@ Route::get('/callback', function (Request $request) {
398398
'Invalid state value.'
399399
);
400400

401-
$response = Http::asForm()->post('http://passport-app.test/oauth/token', [
401+
$response = Http::asForm()->post('https://passport-app.test/oauth/token', [
402402
'grant_type' => 'authorization_code',
403403
'client_id' => 'your-client-id',
404404
'client_secret' => 'your-client-secret',
405-
'redirect_uri' => 'http://third-party-app.com/callback',
405+
'redirect_uri' => 'https://third-party-app.com/callback',
406406
'code' => $request->code,
407407
]);
408408

@@ -454,7 +454,7 @@ If your application issues short-lived access tokens, users will need to refresh
454454
```php
455455
use Illuminate\Support\Facades\Http;
456456

457-
$response = Http::asForm()->post('http://passport-app.test/oauth/token', [
457+
$response = Http::asForm()->post('https://passport-app.test/oauth/token', [
458458
'grant_type' => 'refresh_token',
459459
'refresh_token' => 'the-refresh-token',
460460
'client_id' => 'your-client-id',
@@ -572,7 +572,7 @@ Route::get('/redirect', function (Request $request) {
572572

573573
$query = http_build_query([
574574
'client_id' => 'your-client-id',
575-
'redirect_uri' => 'http://third-party-app.com/callback',
575+
'redirect_uri' => 'https://third-party-app.com/callback',
576576
'response_type' => 'code',
577577
'scope' => 'user:read orders:create',
578578
'state' => $state,
@@ -581,7 +581,7 @@ Route::get('/redirect', function (Request $request) {
581581
// 'prompt' => '', // "none", "consent", or "login"
582582
]);
583583

584-
return redirect('http://passport-app.test/oauth/authorize?'.$query);
584+
return redirect('https://passport-app.test/oauth/authorize?'.$query);
585585
});
586586
```
587587

@@ -606,10 +606,10 @@ Route::get('/callback', function (Request $request) {
606606
InvalidArgumentException::class
607607
);
608608

609-
$response = Http::asForm()->post('http://passport-app.test/oauth/token', [
609+
$response = Http::asForm()->post('https://passport-app.test/oauth/token', [
610610
'grant_type' => 'authorization_code',
611611
'client_id' => 'your-client-id',
612-
'redirect_uri' => 'http://third-party-app.com/callback',
612+
'redirect_uri' => 'https://third-party-app.com/callback',
613613
'code_verifier' => $codeVerifier,
614614
'code' => $request->code,
615615
]);
@@ -677,7 +677,7 @@ Once a client has been created, developers may use their client ID to request a
677677
```php
678678
use Illuminate\Support\Facades\Http;
679679

680-
$response = Http::asForm()->post('http://passport-app.test/oauth/device/code', [
680+
$response = Http::asForm()->post('https://passport-app.test/oauth/device/code', [
681681
'client_id' => 'your-client-id',
682682
'scope' => 'user:read orders:create',
683683
]);
@@ -709,7 +709,7 @@ $interval = 5;
709709
do {
710710
Sleep::for($interval)->seconds();
711711

712-
$response = Http::asForm()->post('http://passport-app.test/oauth/token', [
712+
$response = Http::asForm()->post('https://passport-app.test/oauth/token', [
713713
'grant_type' => 'urn:ietf:params:oauth:grant-type:device_code',
714714
'client_id' => 'your-client-id',
715715
'client_secret' => 'your-client-secret', // required for confidential clients only
@@ -763,7 +763,7 @@ Once you have enabled the grant and have created a password grant client, you ma
763763
```php
764764
use Illuminate\Support\Facades\Http;
765765

766-
$response = Http::asForm()->post('http://passport-app.test/oauth/token', [
766+
$response = Http::asForm()->post('https://passport-app.test/oauth/token', [
767767
'grant_type' => 'password',
768768
'client_id' => 'your-client-id',
769769
'client_secret' => 'your-client-secret', // required for confidential clients only
@@ -786,7 +786,7 @@ When using the password grant or client credentials grant, you may wish to autho
786786
```php
787787
use Illuminate\Support\Facades\Http;
788788

789-
$response = Http::asForm()->post('http://passport-app.test/oauth/token', [
789+
$response = Http::asForm()->post('https://passport-app.test/oauth/token', [
790790
'grant_type' => 'password',
791791
'client_id' => 'your-client-id',
792792
'client_secret' => 'your-client-secret', // required for confidential clients only
@@ -892,14 +892,14 @@ Route::get('/redirect', function (Request $request) {
892892

893893
$query = http_build_query([
894894
'client_id' => 'your-client-id',
895-
'redirect_uri' => 'http://third-party-app.com/callback',
895+
'redirect_uri' => 'https://third-party-app.com/callback',
896896
'response_type' => 'token',
897897
'scope' => 'user:read orders:create',
898898
'state' => $state,
899899
// 'prompt' => '', // "none", "consent", or "login"
900900
]);
901901

902-
return redirect('http://passport-app.test/oauth/authorize?'.$query);
902+
return redirect('https://passport-app.test/oauth/authorize?'.$query);
903903
});
904904
```
905905

@@ -943,7 +943,7 @@ To retrieve a token using this grant type, make a request to the `oauth/token` e
943943
```php
944944
use Illuminate\Support\Facades\Http;
945945

946-
$response = Http::asForm()->post('http://passport-app.test/oauth/token', [
946+
$response = Http::asForm()->post('https://passport-app.test/oauth/token', [
947947
'grant_type' => 'client_credentials',
948948
'client_id' => 'your-client-id',
949949
'client_secret' => 'your-client-secret',
@@ -1124,12 +1124,12 @@ When requesting an access token using the authorization code grant, consumers sh
11241124
Route::get('/redirect', function () {
11251125
$query = http_build_query([
11261126
'client_id' => 'your-client-id',
1127-
'redirect_uri' => 'http://example.com/callback',
1127+
'redirect_uri' => 'https://third-party-app.com/callback',
11281128
'response_type' => 'code',
11291129
'scope' => 'user:read orders:create',
11301130
]);
11311131

1132-
return redirect('http://passport-app.test/oauth/authorize?'.$query);
1132+
return redirect('https://passport-app.test/oauth/authorize?'.$query);
11331133
});
11341134
```
11351135

0 commit comments

Comments
 (0)