PHP code example of zestic / graphql-auth-component

1. Go to this page and download the library: Download zestic/graphql-auth-component 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/ */

    

zestic / graphql-auth-component example snippets


'auth' => [
    'jwt' => [
        'privateKeyPath' => 'config/jwt/private.key',
        'publicKeyPath'  => 'config/jwt/public.key',
        'passphrase'     => null, // Set via environment if needed
        'keyGeneration' => [
            'digestAlg'       => 'sha256',     // sha256, sha384, sha512
            'privateKeyBits'  => 2048,        // 2048, 3072, 4096
            'privateKeyType'  => 'RSA',       // RSA, DSA, DH, EC
        ],
    ],
    'token' => [
        'accessTokenTtl'  => 60,    // 1 hour (in minutes)
        'loginTtl'        => 10,    // 10 minutes
        'refreshTokenTtl' => 10080, // 1 week (in minutes)
        'registrationTtl' => 1440,  // 24 hours (in minutes)
    ],
]
bash
export JWT_PRIVATE_KEY_PATH=/app/keys/jwt/private.key
export JWT_PUBLIC_KEY_PATH=/app/keys/jwt/public.key
export AUTH_LOCAL_CONFIG_PATH=/app/config/autoload/auth.local.php
composer run generate-keys