PHP code example of szabacsik / snowflake-json-web-token

1. Go to this page and download the library: Download szabacsik/snowflake-json-web-token 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/ */

    

szabacsik / snowflake-json-web-token example snippets


    $token = new \Szabacsik\SnowflakeJsonWebToken\Token();
    $token
        ->setAccount('account')
        ->setUsername('username')
        ->setPrivateKeyPath('/path/to/your/private_key.p8')
        ->setPrivateKeyPassphrase('password')
        ->setIssuedAt(time())
        ->setExpirationTime(time() + 3600);
    echo $token->generate();
shell
alter user {{YOUR_USERNAME}} set rsa_public_key='from snowflake_rsa_public_key.pub MIIBIjANBgkqhkiG...';
shell
./tests/EndToEndTest.php