src/OAuth2/ResponseType/JwtAccessToken.php
protected function createPayload($client_id, $user_id, $scope = null)
    {
        // token to encrypt
        $expires = time() + $this->config['access_lifetime'];
        $id = $this->generateAccessToken();

        $payload = array(
            'id'         => $id, // for BC (see #591)
            'jti'        => $id,
            'iss'        => $this->config['issuer'],
            'aud'        => $client_id,
            'sub'        => $user_id,
            'exp'        => $expires,
            'iat'        => time(),
            'token_type' => $this->config['token_type'],
            'scope'      => $scope
        );
        
        if (isset($this->config['jwt_extra_payload_callable'])) {
            if (!is_callable($this->config['jwt_extra_payload_callable'])) {
                throw new \InvalidArgumentException('jwt_extra_payload_callable is not callable');
            }
            
            $extra = call_user_func($this->config['jwt_extra_payload_callable'], $client_id, $user_id, $scope);
            
            if (!is_array($extra)) {
                throw new \InvalidArgumentException('jwt_extra_payload_callable must return array');
            }
            
            $payload = array_merge($extra, $payload);
        }
        
        return $payload;
    }
protected function createPayload($client_id, $user_id, $scope = null)
    {
        // token to encrypt
        $expires = time() + $this->config['access_lifetime'];
        $id = $this->generateAccessToken();

        $payload = array(
            'id'         => $id, // for BC (see #591)
            'jti'        => $id,
            'iss'        => $this->config['issuer'],
            'aud'        => $client_id,
            'sub'        => $user_id,
            'exp'        => $expires,
            'iat'        => time(),
            'token_type' => $this->config['token_type'],
            'scope'      => $scope
        );
        
        if (isset($this->config['jwt_extra_payload_callable'])) {
            if (!is_callable($this->config['jwt_extra_payload_callable'])) {
                throw new \InvalidArgumentException('jwt_extra_payload_callable is not callable');
            }
            
            $extra = call_user_func($this->config['jwt_extra_payload_callable'], $client_id, $user_id, $scope);
            
            if (!is_array($extra)) {
                throw new \InvalidArgumentException('jwt_extra_payload_callable must return array');
            }
            
            $payload = array_merge($extra, $payload);
        }
        
        return $payload;
    }
protected function createPayload ( $ client_id , $ user_id , $ scope = null ) { // token to encrypt $ expires = time ( ) + $ this -> config [ 'access_lifetime' ] ; $ id = $ this -> generateAccessToken ( ) ; $ payload = array ( 'id' => $ id , // for BC (see #591) 'jti' => $ id , 'iss' => $ this -> config [ 'issuer' ] , 'aud' => $ client_id , 'sub' => $ user_id , 'exp' => $ expires , 'iat' => time ( ) , 'token_type' => $ this -> config [ 'token_type' ] , 'scope' => $ scope ) ; if ( isset ( $ this -> config [ 'jwt_extra_payload_callable' ] ) ) { if ( ! is_callable ( $ this -> config [ 'jwt_extra_payload_callable' ] ) ) { throw new \ InvalidArgumentException ( 'jwt_extra_payload_callable is not callable' ) ; } $ extra = call_user_func ( $ this -> config [ 'jwt_extra_payload_callable' ] , $ client_id , $ user_id , $ scope ) ; if ( ! is_array ( $ extra ) ) { throw new \ InvalidArgumentException ( 'jwt_extra_payload_callable must return array' ) ; } $ payload = array_merge ( $ extra , $ payload ) ; } return $ payload ; }
This function can be used to create custom JWT payloads

@param mixed  $client_id           - Client identifier related to the access token.
@param mixed  $user_id             - User ID associated with the access token
@param string $scope               - (optional) Scopes to be stored in space-separated string.
@return array                      - The access token
This function can be used to create custom JWT payloads