Skip to content

Instantly share code, notes, and snippets.

@kmuenkel
Created December 29, 2021 23:40
Show Gist options
  • Save kmuenkel/3286e18c6417eb2c23d030c337b267c0 to your computer and use it in GitHub Desktop.
Save kmuenkel/3286e18c6417eb2c23d030c337b267c0 to your computer and use it in GitHub Desktop.
Create OAuth Bearer token for testing
<?php
$this->client = app(ClientRepository::class)->create(null, $clientName, '');
$response = $this->post(route('passport.token'), [
'grant_type' => 'client_credentials',
'client_id' => $this->client->getKey(),
'client_secret' => $this->client->plainSecret,
'scope' => implode(' ', $scopes)
]);
$this->token = $response->json('token_type').' '.$response->json('access_token');
//Passport::actingAsClient($this->client, AccountScopes::keys());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment