Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Token status #369

Closed
b1n0-kun opened this issue Jun 15, 2023 · 1 comment
Closed

Get Token status #369

b1n0-kun opened this issue Jun 15, 2023 · 1 comment
Labels
question Further information is requested

Comments

@b1n0-kun
Copy link

Hi.
I want to ask about getting Token status into a string, I want to check everytime before I update database, if the token is being refreshed or not, I know it's in the TokenHelper.h but don't know how to get that info into a string.

Highly appreciated.

@b1n0-kun b1n0-kun added the enhancement New feature or request label Jun 15, 2023
@mobizt
Copy link
Owner

mobizt commented Jun 15, 2023

The current auth token can be obtained from Firebase.getToken().

You can check its status with.

Firebase.authenticated() <- returns Firebase authentication status
Firebase.isTokenExpired() <- returns token expiry status

Firebase.ready() <- returns authentication status AND token expiry status AND network status.

<FirebaseData>.httpConnected() returns server connecting state in almost present time.

Normally, library will refresh the token 5 minutes before it expires (60 - 5 or every 55 minutes). You can set the token refresh time earlier than that default value, e.g., refresh in 10 minutes since it created with.

config.signer.preRefreshSeconds = 3600 - 10 * 60;

Or you want to refresh token immediately with.
Firebase.refreshToken(&config);

@mobizt mobizt closed this as completed Jun 15, 2023
@mobizt mobizt added question Further information is requested and removed enhancement New feature or request labels Jun 15, 2023
Repository owner locked and limited conversation to collaborators Jun 15, 2023
@mobizt mobizt converted this issue into discussion #370 Jun 15, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants