codebot
codebot

Reputation: 2646

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.

Upvotes: 2

Views: 757

Answers (1)

Bob
Bob

Reputation: 2510

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"

Upvotes: 3

Related Questions