Invalid token after system/user PATCH


#1

Hi, I am facing a strange issue while I am trying to update emailid of the system user using /system/user/{id} PATCH method, which works fine, it updates without any problem.

The problem I am facing is, the next request always fails with error Invalid token: User verification failed., to be more specific I am calling a PHP service defined in Service Tab, below is some initial code which seems to be failing…

<?php
$verb = $event['request']['method'];

// get resource
$resource = $event['resource'];

// get query params from request
$params = $event['request']['payload'];
//initialize the Tokens for the internal API call
$options = [];
$options['headers'] = [];
$options['headers']['X-DreamFactory-Api-Key'] = $platform['session']['api_key'];
$options['headers']['X-DreamFactory-Session-Token'] = $platform['session']['session_token'];
$options['headers']['Content-Type'] = 'application/json';

switch ($resource) {
   case 'finishUpdate':
        $email = $params['emailid'];
        $userid = $params['userid'];
        $result = ['is_error' => 0 , 'message' => 'Profile updated'];
        return $result ;
   break;
}
?>

In the above code the script method finishUpdate is been called which doesn’t have anything, still I get the Invalid Token error, I have to re login and get fresh token.

It there any underlying process that might be invalidating Session Token on system user update?

How can I resolve this issue?

Thanks for Help.