Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sl0wik committed Oct 14, 2020
2 parents dbb9352 + d01b76e commit fe1cde0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/FirebaseAuthenticationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ public function boot()
public function register()
{
$this->app->singleton(Verifier::class, function ($app) {
$project = config('firebase.project_id', env('GOOGLE_CLOUD_PROJECT'));

if (empty($project)) {
throw new \Exception('Missing GOOGLE_CLOUD_PROJECT env variable.');
}

$keyStore = new HttpKeyStore(null, cache()->store());

return new Verifier(config('firebase.project_id', env('GOOGLE_CLOUD_PROJECT')), $keyStore);
return new Verifier($project, $keyStore);
});
}
}
4 changes: 4 additions & 0 deletions src/FirebaseGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public function user(Request $request)
{
$token = $request->bearerToken();

if (empty($token)) {
return;
}

try {
$token = $this->verifier->verifyIdToken($token);

Expand Down

0 comments on commit fe1cde0

Please sign in to comment.