Allow micropub usage when testing locally

This commit is contained in:
Jonny Barnes 2016-10-03 16:26:07 +01:00
parent 55c8a70918
commit 46f1bfd99f
2 changed files with 15 additions and 0 deletions

View file

@ -45,6 +45,18 @@ class AppServiceProvider extends ServiceProvider
$note->tags()->attach($tagsToAdd); $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']);
}
} }
/** /**

View file

@ -38,6 +38,9 @@ class TokenService
*/ */
public function validateToken($token) public function validateToken($token)
{ {
if (env('APP_DEBUG') == true) {
return true;
}
$signer = new Sha256(); $signer = new Sha256();
try { try {
$token = (new Parser())->parse((string) $token); $token = (new Parser())->parse((string) $token);