如何从自定义身份提供程序中的响应参数中提取数据
How to extract data from response params in the custom identity provider
自从 ConnectyCube 服务器进行了最新维护后,我在使用自定义身份提供程序进行身份验证时遇到了一个新问题。
我使用 Firebase 作为端点,它 return 以下 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
- 请求 HEADERS: {"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) {});
这应该又可以工作了
请检查
自从 ConnectyCube 服务器进行了最新维护后,我在使用自定义身份提供程序进行身份验证时遇到了一个新问题。
我使用 Firebase 作为端点,它 return 以下 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
- 请求 HEADERS: {"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) {});
这应该又可以工作了
请检查