# How to Re-login the user silently in background after the token is expired?

**URL:** <https://community.auth0.com/t/how-to-re-login-the-user-silently-in-background-after-the-token-is-expired/20529>\
**Category:** Get Help\
**Tags:** auth0swift, swift, ios\
**Created:** [January 25, 2019, 9:31am UTC](https://community.auth0.com/t/how-to-re-login-the-user-silently-in-background-after-the-token-is-expired/20529 "2019-01-25T09:31:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MuraliKathir](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/muralikathir/32/13050_2.png) [@MuraliKathir](https://community.auth0.com/u/MuraliKathir)\
**Post date:** [January 25, 2019, 9:31am UTC](https://community.auth0.com/t/how-to-re-login-the-user-silently-in-background-after-the-token-is-expired/20529/1 "2019-01-25T09:31:23Z")

</div>

Once I log in the user with successful credentials, I have a time duration which the token expires.  
When the token expires, how to **log in the user automatically in the background**?

I use the iOS Swift SDK.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 25, 2019, 3:26pm UTC](https://community.auth0.com/t/how-to-re-login-the-user-silently-in-background-after-the-token-is-expired/20529/2 "2019-01-25T15:26:49Z")

</div>

Hey there!

The concept that you need to grasp are **refresh tokens** 🙂

Here are our simple and step-by-step docs on that:

> **[Refresh Tokens](https://auth0.com/docs/secure/tokens/refresh-tokens)**
>
> Describes how refresh tokens work to allow the application to ask Auth0 to issue a new access token or ID token without having to re-authenticate the user.

> **[Understanding Refresh Tokens](https://auth0.com/learn/refresh-tokens)**
>
> Learn about refresh tokens and the role they serve in the authorization process

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 29, 2019, 9:22am UTC](https://community.auth0.com/t/how-to-re-login-the-user-silently-in-background-after-the-token-is-expired/20529/3 "2019-08-29T09:22:55Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
