Looking to hire Laravel developers? Try LaraJobs

google-iap-laravel maintained by yumemi-inc

Description
Authentication guard on Laravel for verifying requests from Google IAP (Identity-Aware Proxy).
Last update
2026/04/02 04:16 (dev-dependabot/composer/kelvinmo/simplejwt-1.1.1)
License
Links
Downloads
3 140

Comments
comments powered by Disqus

Laravel Authentication for Google IAP

php

Warning
This is not an official product of YUMEMI Inc.

Authentication guard on Laravel for verifying requests from Google IAP (Identity-Aware Proxy).

Prerequisites

  • PHP 8.1 or later
    • ext-gmp for JWT verification
  • Laravel 9, 10, or 11 (dev)

Getting Started

  1. Require this package as a dependency.

    composer require yumemi-inc/google-iap-laravel
    
  2. Implement GoogleUserResolver as you need.

    <?php // app/Security/AppGoogleUserResolver.php (new)
    
    use Illuminate\Contracts\Auth\Authenticatable;
    use Illuminate\Contracts\Auth\UserProvider;
    use YumemiInc\GoogleIapLaravel\Claims;
    use YumemiInc\GoogleIapLaravel\GoogleUserResolver;
    
    class AppGoogleUserResolver implements GoogleUserResolver
    {
        public function provide(Claims $claims, UserProvider $userProvider): ?Authenticatable
        {
            return $userProvider->retrieveByCredentials([
                'google_user_id' => $claims->id(),
            ]);
        }
    }
    
  3. Register the user resolver as a service.

    <?php // app/Providers/AppServiceProvider.php
    
    use YumemiInc\GoogleIapLaravel\GoogleUserResolver;
    
    public function register(): void
    {
        $this->app->bind(GoogleUserProvider::class, AppGoogleUserProvider::class);
    }
    
  4. Use the guard provided in this package.

    <?php // config/auth.php
    
    'guards' => [
        'google-iap' => [
             'driver' => 'google-iap',
             'provider' => 'users',
         ],
    ]