简体   繁体   English

刷新 Firebase iOS 中的身份验证令牌时出错

[英]Error on refreshing auth token in Firebase iOS

I'm trying to refresh my auth token in Firebase using swift as follows我正在尝试使用 swift 在 Firebase 中刷新我的身份验证令牌,如下所示

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.我遇到了同样的错误,但使用了 Web API。 Solved it by解决了

  1. Going to https://console.developers.google.com/apis/credentials ,前往https://console.developers.google.com/apis/credentials
  2. Clicking on the API key点击 API 键
  3. Enabling the "Token Service API", along with "Identity Toolkit API"启用“令牌服务 API”以及“身份工具包 API”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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