How to cast or return the expiry token field in Custom Authentication

Database & APIs

I have a custom API which returns a response like this one

{
    "result": {
        "email": "[email protected]",
        "phoneNumber": "1234567890",
        "firstName": "George",
        "lastName": "Best",
        "biography": null,
        "locale": "en-US",
        "timezone": null,
        "picture": null,
        "roleNames": [
            "MyRole"
        ],
        "accessToken": "[...]",
        "refreshToken": "[...]",
        "expires": 1733669932
    },
    "isSuccess": true,
    "errors": [
    ]
}

The field expires is a unix timestamp representing a date (e.g. in this case Sun Dec 08 2024 14:58:52 GMT+0000)

First Question

How can i define this field in the User Data Type? I mean, shall I use Integer for example? In my backend is defined as a long value (64 bits integer).

Second question

How can I use this field to fill up the Token Expiry Time field in the Login Action? That is, how can I transform it back to DateTime type?

What have you tried so far?

I have tried using the utility function DateTime from Unix but was not able to make it working.

Did you check FlutterFlow's Documentation for this topic?
Yes
3
1 reply