Generate a token on the fly if one doesn’t exist
This commit is contained in:
parent
e7407fb09c
commit
ae9ed10f65
1 changed files with 8 additions and 0 deletions
|
@ -20,6 +20,14 @@ class DevTokenMiddleware
|
|||
session(['me' => config('app.url')]);
|
||||
if (Storage::exists('dev-token')) {
|
||||
session(['token' => Storage::get('dev-token')]);
|
||||
} else {
|
||||
$data = [
|
||||
'me' => config('app.url'),
|
||||
'client_id' => route('micropub-client'),
|
||||
'scope' => 'post',
|
||||
];
|
||||
$tokenService = new \App\Services\TokenService();
|
||||
session(['token' => $tokenService->getNewToken($data)]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue