public function generateToken($ttl = 3600) {
        $payload = array_merge($this->customClaims, array(
            'scope' => array(),
            'iss' => $this->accountSid,
            'exp' => time() + $ttl,
        ));
        $scopeStrings = array();

        foreach ($this->scopes as $scope) {
            if ($scope->privilege == "outgoing" && $this->clientName)
                $scope->params["clientName"] = $this->clientName;
            $scopeStrings[] = $scope->toString();
        }

        $payload['scope'] = implode(' ', $scopeStrings);
        return JWT::encode($payload, $this->authToken, 'HS256');
    }
public function generateToken($ttl = 3600) {
        $payload = array_merge($this->customClaims, array(
            'scope' => array(),
            'iss' => $this->accountSid,
            'exp' => time() + $ttl,
        ));
        $scopeStrings = array();

        foreach ($this->scopes as $scope) {
            if ($scope->privilege == "outgoing" && $this->clientName)
                $scope->params["clientName"] = $this->clientName;
            $scopeStrings[] = $scope->toString();
        }

        $payload['scope'] = implode(' ', $scopeStrings);
        return JWT::encode($payload, $this->authToken, 'HS256');
    }
public function generateToken ( $ ttl = 3600 ) { $ payload = array_merge ( $ this -> customClaims , array ( 'scope' => array ( ) , 'iss' => $ this -> accountSid , 'exp' => time ( ) + $ ttl , ) ) ; $ scopeStrings = array ( ) ; foreach ( $ this -> scopes as $ scope ) { if ( $ scope -> privilege == "outgoing" && $ this -> clientName ) $ scope -> params [ "clientName" ] = $ this -> clientName ; $ scopeStrings [ ] = $ scope -> toString ( ) ; } $ payload [ 'scope' ] = implode ( ' ' , $ scopeStrings ) ; return JWT :: encode ( $ payload , $ this -> authToken , 'HS256' ) ; }
Generates a new token based on the credentials and permissions that
previously has been granted to this token.

@param int $ttl the expiration time of the token (in seconds). Default
value is 3600 (1hr)
@return ClientToken the newly generated token that is valid for $ttl
seconds
Generates a new token based on the credentials and permissions that previously has been granted to this token .