简体   繁体   中英

Error on refreshing auth token in Firebase iOS

I'm trying to refresh my auth token in Firebase using swift as follows

let currentUser = Auth.auth().currentUser
currentUser?.getIDTokenForcingRefresh(true) { idToken, error in
    if error != nil {
       return;
    }
    self.userDataManager.fetchUser()
}

It's hitting the error return statement with,

message = "Requests to this API securetoken.googleapis.com method google.identity.securetoken.v1.SecureToken.GrantToken are blocked.";
status = "PERMISSION_DENIED";

I search around the docs, But couldn't find a proper solution for this. Please help with this.

I had the same error but with the Web APIs. Solved it by

  1. Going to https://console.developers.google.com/apis/credentials ,
  2. Clicking on the API key
  3. Enabling the "Token Service API", along with "Identity Toolkit API"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM