title: How to get the token expiry date - Firebase iOS
body: <p>I'm currently using firebase for authentication.
  Can I get the login token expiry date?
  I want to refresh the token when the token had been expired.</p>
  
  <p>Here I retrieve the login token.:</p>
  
  <pre><code>func authUI(_ authUI: FUIAuth, didSignInWith user: User?, error: Error?) {
      Auth.auth().addStateDidChangeListener { auth, user in
          if user != nil {
  
              if let providerData = authUI.auth?.currentUser?.providerData {
                  for userInfo in providerData {
                      let currentUser = Auth.auth().currentUser
                      currentUser?.getIDToken(completion: { (idToken, error) in
                          print("idToken====\(String(describing: idToken!))")
                          if let error = error {
                              // Handle error
                              return; 
                          }else{
                          }
  
                          // Send token to your backend 
  
                      })
  
  }
  </code></pre>