PHP code example of felipemenezesdm / auth-server-connect-laravel

1. Go to this page and download the library: Download felipemenezesdm/auth-server-connect-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

felipemenezesdm / auth-server-connect-laravel example snippets


protected $middlewareGroups = [
  'web' => [
      // [...],
      \FelipeMenezesDM\AuthServerConnectLaravel\Middleware\AuthServerConnect::class,
  ],
  
  'api' => [
      // [...],
      \FelipeMenezesDM\AuthServerConnectLaravel\Middleware\AuthServerConnect::class,
  ],
];

#[AuthServerConnection]
class MyController extends Controller
{
    public static ?AuthServerToken $authServerToken;
}

#[AuthServerValidation(scopes: ['my-scope'])]
class MyController extends Controller
{
    #[Route(name: 'my-route', path: '/api/v1')]
    public function myRoute() : void
    {
    }
}

class MyController extends Controller
{
    #[AuthServerValidation(scopes: ['my-scope'])]
    #[Route(name: 'my-route', path: '/api/v1')]
    public function myRoute() : void
    {
    }
}

#[AuthServerValidation(scopes: ['my-scope'])]
class MyController extends Controller
{
    #[AuthServerValidation(scopes: ['my-scope-2'])]
    #[Route(name: 'my-route', path: '/api/v1/{id}')]
    public function myRoute() : void
    {
    }
    
    #[Route(name: 'my-route2', path: '/api/v1')]
    public function myRoute2() : void
    {
    }
}
dotenv
AUTH_SERVER_PROVIDER=environment
AUTH_SERVER_URI=http://localhost:1080/api/v1
client_id=9835e498-eb18-4d7a-8e8e-230b2190df1f
client_secret=51469bf9-081f-4023-a391-b94877bb5b1b
dotenv
AUTH_SERVER_PROVIDER=environment
AUTH_SERVER_URI=http://localhost:1080/api/v1
shell
export client_id=9835e498-eb18-4d7a-8e8e-230b2190df1f
export client_secret=51469bf9-081f-4023-a391-b94877bb5b1b
dotenv
AUTH_SERVER_PROVIDER=aws
AUTH_SERVER_URI=http://localhost:1080/api/v1
AUTH_SERVER_SECRET_NAME=my-secret-name
AUTH_SERVER_REGION=us-east-1
dotenv
AUTH_SERVER_PROVIDER=gcp
AUTH_SERVER_URI=http://localhost:1080/api/v1
AUTH_SERVER_SECRET_NAME=my-secret-name
AUTH_SERVER_PROJECT_ID=gcp-project