Skip to content

Commit 1516f8e

Browse files
committed
Updates for passport API
1 parent c57f6d1 commit 1516f8e

2 files changed

Lines changed: 14 additions & 16 deletions

File tree

ProcessMaker/Http/Controllers/Auth/ClientController.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,14 @@ public function store(Request $request)
4646

4747
// Use ClientRepository methods based on type
4848
if ($personalAccess) {
49-
$client = $this->clients->createPersonalAccessClient(
50-
$request->user()->getKey(),
51-
$request->name,
52-
$redirect
49+
$client = $this->clients->createPersonalAccessGrantClient(
50+
$request->name
5351
);
5452
} elseif ($password) {
5553
$client = $this->clients->createPasswordGrantClient(
56-
$request->user()->getKey(),
5754
$request->name,
58-
$redirect
55+
null, // provider
56+
false // confidential
5957
);
6058
} else {
6159
// Authorization code grant

database/seeders/UserSeeder.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,22 @@ public function run(ClientRepository $clients)
5555
]);
5656

5757
// Create client so we can generate tokens
58-
$clients->createPersonalAccessClient(
59-
null,
60-
'PmApi',
61-
'http://localhost'
62-
);
58+
$clients->createPersonalAccessGrantClient('PmApi');
6359

64-
// Create client OAuth (for 3-legged auth)
65-
$clients->create(
66-
null,
60+
// Create client OAuth (for 3-legged auth) - Authorization Code Grant for Swagger UI
61+
$clients->createAuthorizationCodeGrantClient(
6762
'Swagger UI Auth',
68-
env('APP_URL', 'http://localhost') . '/api/oauth2-callback'
63+
[env('APP_URL', 'http://localhost') . '/api/oauth2-callback'],
64+
true, // confidential
65+
null, // user (system client)
66+
false // enableDeviceFlow
6967
);
7068

7169
// Allow users get at token using the password grant flow
7270
$clients->createPasswordGrantClient(
73-
null, 'Password Grant', 'http://localhost'
71+
'Password Grant',
72+
null, // provider
73+
false // confidential
7474
);
7575
}
7676
}

0 commit comments

Comments
 (0)