Allow micropub usage when testing locally
This commit is contained in:
parent
55c8a70918
commit
46f1bfd99f
2 changed files with 15 additions and 0 deletions
|
@ -45,6 +45,18 @@ class AppServiceProvider extends ServiceProvider
|
|||
$note->tags()->attach($tagsToAdd);
|
||||
}
|
||||
});
|
||||
|
||||
//allow micropub use in development
|
||||
if (env('APP_DEBUG') == true) {
|
||||
$tokenService = new \App\Services\TokenService();
|
||||
$token = $tokenService->getNewToken([
|
||||
'me' => 'https://jonnybarnes.localhost',
|
||||
'client_id' => 'https://jonnybarnes.localhost/notes/new',
|
||||
'scope' => 'post'
|
||||
]);
|
||||
session(['me' => 'https://jonnybarnes.localhost']);
|
||||
session(['token' => 'abc123']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,6 +38,9 @@ class TokenService
|
|||
*/
|
||||
public function validateToken($token)
|
||||
{
|
||||
if (env('APP_DEBUG') == true) {
|
||||
return true;
|
||||
}
|
||||
$signer = new Sha256();
|
||||
try {
|
||||
$token = (new Parser())->parse((string) $token);
|
||||
|
|
Loading…
Add table
Reference in a new issue