auth0-flutter icon indicating copy to clipboard operation
auth0-flutter copied to clipboard

Credentials on Android have incorrect expiresAt value

Open aluu4445 opened this issue 1 year ago • 1 comments

Checklist

  • [X] The issue can be reproduced in the auth0_flutter sample app (or N/A).
  • [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • [X] I have looked into the API documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

Description

When I login on Android, the returned Credentials object has an expiresAt value that is off by 7 hours.

Here is the relevant code snippet from the sample app with a print statement that I added:

      final result = await webAuth.login(
        redirectUrl: dotenv.env['AUTH0_REDIRECT_URI'],
        audience: dotenv.env['AUTH0_AUDIENCE'],
      );

      setState(() {
        _isLoggedIn = true;
      });

      output = result.idToken;
      print(result.expiresAt.difference(DateTime.now()));

I would expect this to be close to my access token lifetime of 5 minutes.

Here is the printed value that I get: -6:55:01.311274

Reproduction

  1. Login on Android
  2. Read the expiresAt value in the returned Credentials object
  3. Observe the difference between the expiresAt value and DateTime.now()

Additional context

No response

auth0_flutter version

1.6.0

Flutter version

3.16.9

Platform

Android

Platform version(s)

No response

aluu4445 avatar Mar 28 '24 18:03 aluu4445

It looks like this is related to https://github.com/auth0/auth0-flutter/pull/469

gferon avatar Sep 09 '24 11:09 gferon