{ "kind": "identitytoolkit#GetAccountInfoResponse", "users": [ { "localId": "XR9iEJd8SpWLZyIlTclB77lquz52", "email": "[email protected]", "passwordHash": "UkVEQUNURUQ=", "emailVerified": false, "passwordUpdatedAt": 1666284051842, "providerUserInfo": [ { "providerId": "password", "federatedId": "[email protected]", "email": "[email protected]", "rawId": "[email protected]" } ], "validSince": "1666284051", "lastLoginAt": "1666346094257", "createdAt": "1666284051842", "lastRefreshAt": "2022-10-21T09:54:54.257Z" } ] }
CodePudding user response:
If I understood your question correctly, you want to return the "localId", but since it's an array I will assume you will have multiple users. So here's an example of how you can return an array of the "localId" in react or JavaScript in general:
const obj= { "kind": "identitytoolkit#GetAccountInfoResponse", "users": [ { "localId": "XR9iEJd8SpWLZyIlTclB77lquz52", "email": "[email protected]", "passwordHash": "UkVEQUNURUQ=", "emailVerified": false, "passwordUpdatedAt": 1666284051842, "providerUserInfo": [ { "providerId": "password", "federatedId": "[email protected]", "email": "[email protected]", "rawId": "[email protected]" } ], "validSince": "1666284051", "lastLoginAt": "1666346094257", "createdAt": "1666284051842", "lastRefreshAt": "2022-10-21T09:54:54.257Z" } ] };
const ids= obj.users.map((e)=>e.localId);
response: ids=[XR9iEJd8SpWLZyIlTclB77lquz52];