由于 ConnectyCube 服务器的最新维护,我在使用自定义身份提供者进行身份验证时遇到了一个新问题。
我使用 Firebase 作为端点,它返回以下 json 文件(用 Postman 测试):
{
"kind": "identitytoolkit#GetAccountInfoResponse",
"users": [
{
"localId": "The uid that I want to get",
"email": "test@test.com",
"passwordHash": "xxxxxx",
"emailVerified": false,
"passwordUpdatedAt": 1607681539305,
"providerUserInfo": [
{
"providerId": "password",
"federatedId": "test@test.com",
"email": "test@test.com",
"rawId": "test@test.com"
}
],
"validSince": "1607681539",
"disabled": false,
"lastLoginAt": "1620422687374",
"createdAt": "1607681539305",
"lastRefreshAt": "2021-05-07T21:24:47.374Z"
}
]
}
以前,为了获取 localId,我使用以下作为响应参数{"uid": "#{users[0].localId}"}
并且它有效。现在,"base":["Custom Identity Provider uid is required"]
当我尝试登录用户时出现错误,而我的代码没有任何变化。
您是否有不使用 [0] 来访问 localID 参数的解决方案,因为这似乎是问题的原因?
我对自定义身份提供者的当前设置:
- 端点:https ://identitytoolkit.googleapis.com/v1/accounts:lookup?key=API_WEBKEY
- 请求标头:{“Content-Type”:“application/json”}
- 请求参数:{“idToken”:“#{login}”}
- 响应参数:{“uid”:“#{users[0].localId}”}
出现错误的脚本的摘录:
final token = await FirebaseLib().auth.currentUser.getIdToken();
createSession().then((cubeSession) {
CubeUser user = CubeUser(login: "$token", password: "");
signIn(user).then((cubeUser) {
Print("Worked!");
}).catchError((error) {});
}).catchError((error) {});