Auth0\SDK\API\Authentication::delegation PHP Method

delegation() public method

public delegation ( $id_token, $type, $target_client_id, $api_type, $aditional_params = [], $scope = 'openid', $grant_type = 'urn:ietf:params:oauth:grant-type:jwt-bearer' )
    public function delegation($id_token, $type, $target_client_id, $api_type, $aditional_params = [], $scope = 'openid', $grant_type = 'urn:ietf:params:oauth:grant-type:jwt-bearer')
    {
        if (!in_array($type, ['id_token', 'refresh_token'])) {
            throw new ApiException('Delegation type must be id_token or refresh_token');
        }
        $data = array_merge($aditional_params, ['client_id' => $this->client_id, 'target' => $target_client_id, 'grant_type' => $grant_type, 'scope' => $scope, 'api_type' => $api_type, $type => $id_token]);
        return $this->apiClient->post()->delegation()->withHeader(new ContentType('application/json'))->withBody(json_encode($data))->call();
    }