User Info
Ability to get user details like their email addresses directly from the client API and the SDKs is on our roadmap. You can keep track of the issue here: https://github.com/authgear/authgear-server/issues/260

UserInfo

At the meantime, the userInfo object is returned from calling fetch user info function which contains a unique identifier of the user.
Key
Type
Description
isAnonymous
boolean
Indicate if the user is anonymous, i.e. no identity or authenticator is provided
isVerified
boolean
Indicate if the user completed the verification requirement
sub
string
Unique identifier of the user in your Authgear project
JavaScript
iOS
Android
1
try{
2
const userInfo = await authgear.fetchUserInfo()
3
} catch(e) {
4
// failed to fetch user info
5
// the refresh token maybe expired or revoked
6
}
Copied!
1
authgear.fetchUserInfo { userInfoResult in
2
// sessionState is now up to date
3
// it will change to .noSession if the session is invalid
4
let sessionState = authgear.sessionState
5
6
switch userInfoResult {
7
case let .success(userInfo):
8
// read the userInfo if needed
9
case let .failure(error):
10
// failed to fetch user info
11
// the refresh token maybe expired or revoked
12
}
Copied!
1
authgear.fetchUserInfo(new OnFetchUserInfoListener() {
2
@Override
3
public void onFetchedUserInfo(@NonNull UserInfo userInfo) {
4
// sessionState is now up to date
5
// read the userInfo if needed
6
}
7
8
@Override
9
public void onFetchingUserInfoFailed(@NonNull Throwable throwable) {
10
// sessionState is now up to date
11
// it will change to NO_SESSION if the session is invalid
12
}
13
});
Copied!
Last modified 4mo ago
Copy link
Contents
UserInfo