Lifetime Services API - Invalid or expired token.

Hi!

I'm trying to consume the Lifetime api but keep getting this error:


<User_CreateOrUpdateResponse xmlns="http://www.outsystems.com">
         <Success>false</Success>
         <Status>
            <Id>18</Id>
            <ResponseId>201</ResponseId>
            <ResponseMessage>Invalid credentials provided in WS call.</ResponseMessage>
            <ResponseAdditionalInfo>Invalid or expired token.</ResponseAdditionalInfo>
         </Status>
         <PlatformUser>
            <Id>0</Id>
            <Username/>
            <Name/>
            <Email/>
            <RoleName/>
         </PlatformUser>
      </User_CreateOrUpdateResponse>


I've created the token through "Lifetime -> User Management -> Service Accounts" and the username i'm passing is the one i use to login in Lifetime web app.


I've notice that in the documentation (https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/LifeTime_Services_API#Structure_WebServiceSimpleAuthentication) the token should be only Text (50) but the generated one is 258.


Any clue?


Solution

Hi Francisco,

If  I read you post correct you are trying to call the UserManagementService of the LifeTimeAPI.

The documentation states that you can call this server in two ways:

  1. by sending an authentication argument with username/password, or 
  2. use the AuthenticationService Web Service API to acquire a session token to send as argument

So you either generate the token and use that, or you use a LifeTime user account with enough rights (monitor & reuse) or use use the session token you can retrieve from the AuthenticationService.

You created a Service Account token in the LifeTime application, which maybe be not the same think as the session token returned by the AuthenticationService.

Regards,

Daniel

Solution

Hi Daniel,


Thanks for help, all good now!