Generate a token on the fly if one doesn’t exist

This commit is contained in:
Jonny Barnes 2017-02-24 14:33:35 +00:00
parent e7407fb09c
commit ae9ed10f65

View file

@ -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)]);
}
}