* create zapier app * install sanctum * move OAuthProviderController * make `api-external` middleware * add zapier endpoints * add tests * token management * zapier event handler * add policy * use `slug` instead of `id` * wip * check policies * change api prefix to `external` * ui tweaks * validate token abilities * open zapier URL * zapier ui tweaks * update zap * Fix linting * Added sample endpoints + minor UI changes * Run PHP code linter --------- Co-authored-by: Julien Nahum <julien@nahum.net>
25 lines
504 B
PHP
25 lines
504 B
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
use Laravel\Sanctum\Sanctum;
|
|
|
|
use function Pest\Laravel\get;
|
|
|
|
test('validate auth', function () {
|
|
$user = User::factory()->create();
|
|
|
|
Sanctum::actingAs($user);
|
|
|
|
get(route('zapier.validate'))
|
|
->assertOk()
|
|
->assertJson([
|
|
'name' => $user->name,
|
|
'email' => $user->email,
|
|
]);
|
|
});
|
|
|
|
test('cannot validate auth with incorrect credentials', function () {
|
|
get(route('zapier.validate'))
|
|
->assertUnauthorized();
|
|
});
|