public function setupSecret()
    {
        // gets the key from config.
        $secret = $this->config->get('jwt.secret');

        // if the secret is in a base64 format, unwrap it's value
        if (Str::startsWith($secret, 'base64:')) {
            // remove the 'base64:' part and decode the value.
            $secret = base64_decode(substr($secret, 7));
        }

        // set the secret on the local scope.
        $this->secret = $secret;

        // if the secret is not valid,
        // throw an exception to avoid continuing.
        if (!$this->validSecret()) {
            throw new \Exception('Invalid Secret (not present or too short). Use php artisan jwt:generate to create a valid key.');
        }
    }
public function setupSecret()
    {
        // gets the key from config.
        $secret = $this->config->get('jwt.secret');

        // if the secret is in a base64 format, unwrap it's value
        if (Str::startsWith($secret, 'base64:')) {
            // remove the 'base64:' part and decode the value.
            $secret = base64_decode(substr($secret, 7));
        }

        // set the secret on the local scope.
        $this->secret = $secret;

        // if the secret is not valid,
        // throw an exception to avoid continuing.
        if (!$this->validSecret()) {
            throw new \Exception('Invalid Secret (not present or too short). Use php artisan jwt:generate to create a valid key.');
        }
    }
public function setupSecret ( ) { // gets the key from config. $ secret = $ this -> config -> get ( 'jwt.secret' ) ; // if the secret is in a base64 format, unwrap it's value if ( Str :: startsWith ( $ secret , 'base64:' ) ) { // remove the 'base64:' part and decode the value. $ secret = base64_decode ( substr ( $ secret , 7 ) ) ; } // set the secret on the local scope. $ this -> secret = $ secret ; // if the secret is not valid, // throw an exception to avoid continuing. if ( ! $ this -> validSecret ( ) ) { throw new \ Exception ( 'Invalid Secret (not present or too short). Use php artisan jwt:generate to create a valid key.' ) ; } }
Setup the secret that will be used to sign keys.
Setup the secret that will be used to sign keys .