Account creation date or/and login start date for the current session

Is there a way to get the account creation date or/and login start date for the current session from a cloud call api, withouth having to send this information from the client?

If not we can just store it via cloud script into a cloud save entry on session start via Date.now();
Just asking in case this information is somehow already available.

Hi David,

I think the solution you identified yourself is the best one. There isn't a Cloud Call that can directly provide the first and current session start times. But you could save the first login timetsamp and last session start timetstamps in Cloud Save from a Cloud Code script, triggered by the client each time it launches.

One other option would be to decode the jwt claims in the Authentication access token. The token retruned by the Authentication service has an iat claim which describes when the token was issued. It's not exactly what you asked for though and is a bit more complex, and tokens get refreshed after an hour so the start of the session might not be accurate.

As to how to decode the accessToken - https://stackoverflow.com/questions/38552003/how-to-decode-jwt-token-in-javascript-without-using-a-library

I hope that helps.

1 Like

Hi Laurie

I think we just write the cloud save entries ourself then, the token sounds like a wild card to depend on for what we plan.

Thanks for the quick answer.

where though