Identify users¶
Introduction¶
If you have configured your application, you can start using GetSocial without any additional steps. GetSocial creates anonymous user by default, so you can access all the features right after SDK gets initialized.
Anonymous user is just a user, that has no identities added. User is created per device and stays there for next sessions. Anonymous users have default names like “User 12345678”, but you can easily change it.
Not supported by Web SDK
The Web SDK doesn’t have support for anonymous users. For security reasons, only trusted identities are allowed.
To check if user is anonymous:
val isAnonymous = GetSocial.getCurrentUser()?.isAnonymous
let anonymous = GetSocial.currentUser().isAnonymous()
var anonymous = GetSocial.GetCurrentUser().IsAnonymous;
var currentUser = await GetSocial.currentUser;
var isAnonymous = currentUser.isAnonymous;
const currentUser = await GetSocial.getCurrentUser();
const isAnonymous = currentUser.isAnonymous;
Identify user¶
If you have internal login system or use any social authentication, you should connect your account to GetSocial user, so you can retrieve the same GetSocial user from another devices or recover it once app was reinstalled or user was logged out.
To connect GetSocial user with yours, you should add your identity to GetSocial user.
Identities¶
An identity is some unique user data to identify them among other users. You can use any auth provider to create an identity (your custom login, facebook, twitter, google, github, etc). Each user may have any number of different identities, but only one of the same provider. It means that you may attach one facebook, one twitter and one custom identity, but you can not attach two facebook identities. Read more how to attach multiple identities.
To create an identity:
// Create Facebook identity
val fbIdentity = Identity.facebook(fbAccessToken)
// Create Custom Identity
val custom = Identity.custom(providerId, userId, accessToken)
// Create Facebook identity
let fbIdentity = Identity.facebook(accessToken: fbAccessToken)
// Create Custom Identity
let custom = Identity.custom(providerId: providerId, userId: userId, accessToken: accessToken)
// Create Facebook identity
var fbIdentity = Identity.Facebook(fbAccessToken);
// Create Custom Identity
var customIdentity = Identity.Custom(providerId, userId, accessToken);
// Create Facebook identity
var fbIdentity = Identity.facebook(fbAccessToken);
// Create Custom Identity
var customIdentity = Identity.custom(providerId, userId, accessToken);
// Create Facebook identity
const fbIdentity = Identity.createFacebookIdentity(accessToken);
// Create Custom Identity
const customIdentity = Identity.createCustomIdentity(providerId, userId, accessToken);
// Create Facebook identity
const fbIdentity = GetSocialSDK.Identity.createFacebookIdentity(accessToken);
// Create Custom Identity
const customIdentity = GetSocialSDK.Identity.createCustomIdentity(providerId, userId, accessToken);
providerId
is a uniquestring
defined by you for each provider (twitter
,my_auth_system
,gamecenter
, etc).userId
is a uniqueUserId
for each user in the provided authentication system. So pairproviderId
-userId
is unique for each user and helps GetSocial identify a user if them try to login from another device.accessToken
is astring
for security check, that could be some internal hash function in your app based onuserId
. If user is trying to authenticate again with the sameproviderId
anduserId
, but differentaccessToken
- GetSocial won’t allow to authenticate.accessToken
can not be changed.
Add Identity¶
You have to add an identity to GetSocial user in the success callback of your authentication system.
fun onLoginSuccess() {
val userId = getCurrentUserId() // get user ID on your login provider
val accessToken = calculateAccessTokenForUser(userId) // see the example of such a function below
val identity = Identity.custom("my_auth_system", userId, accessToken)
val currentUser = GetSocial.getCurrentUser()
if (currentUser == null) {
// you can't add identity before SDK is initialized
return
}
currentUser.addIdentity(identity, {
Log.d("CurrentUser", "Identity added successfully")
}, { conflictUser: ConflictUser ->
handleConflic(identity, conflictUser)
}, { error: GetSocialError ->
Log.d("CurrentUser", "Failed to add identity: $error")
})
}
fun calculateAccessTokenForUser(userId: String): String {
return ... // you should implement your function to be identical on all platforms
}
let userId = getCurrentUserId() // get user ID on your login provider
let accessToken = calculateAccessToken(userId) // see the example of such a function below
let identity = Identity.custom(providerId: "my_auth_system", userId: userId, accessToken: accessToken)
GetSocial.currentUser()?.addIdentity(identity, success: {
print("Successfully logged into \(userId)")
}, conflict: { conflictUser in
self.handleConflict(identity: identity, conflictUser: conflictUser)
}, failure: { error in
print("Failed to log into \(userId)")
})
func calculateAccessToken(userId: String) -> String {
return ... // you should implement your function to be identical on all platforms
}
var userId = GetCurrentUserId(); // get user ID on your login provider
var accessToken = CalculateAccessToken(userId); // generate access token. make sure token generation code returns the same result on every platform.
var identity = Identity.Custom("my_auth_system", userId, accessToken);
GetSocial.GetCurrentUser().AddIdentity(identity, () => {
Debug.Log("Successfully logged into " + userId);
}, (conflictUser) => {
HandleConflict(conflictUser);
}, (error) => {
Debug.Log("Failed to log into " + userId);
});
string CalculateAccessToken(string userId)
{
return ... // make sure token generation code returns the same result on every platform
}
var userId = getCurrentUserId(); // get user ID on your login provider
var accessToken = calculateAccessToken(); // generate access token. make sure token generation code returns the same result on every platform.
var identity = Identity.custom('my_auth_system', userId, accessToken);
var user = await GetSocial.currentUser;
user.addIdentity(
identity,
() => { print('Successfully logged into ' + userId)},
(conflictUser) => { handleConflict(conflictUser) },
(error) => { print('Failed to log into ' + userId)});
}
String calculateAccessToken(String userId) {
return ... // make sure token generation code returns the same result on every platform
}
const userId = getCurrentUserId(); // get user ID on your login provider
const accessToken = calculateAccessToken(); // generate access token. make sure token generation code returns the same result on every platform.
const identity = Identity.createCustomIdentity('my_auth_system', userId, accessToken);
const currentUser = await GetSocial.getCurrentUser();
currentUser.addIdentity(
identity,
() => { console.log('Successfully logged into ' + userId); },
(conflictUser) => { handleConflict(conflictUser); },
(error) => { console.log('Failed to log into ' + userId); });
func calculateAccessToken(String userId) {
return ... // make sure token generation code returns the same result on every platform
}
const userId = getCurrentUserId(); // get user ID on your login provider
const accessToken = calculateAccessToken(); // generate access token. make sure token generation code returns the same result on every platform.
const identity = GetSocialSDK.Identity.createCustomIdentity('my_auth_system', userId, accessToken);
const currentUser = GetSocialSDK.GetSocial.getCurrentUser();
currentUser.addIdentity(identity)
.then(() => {
console.log('Successfully logged as ' + userId);
}, (error) => {
if (typeof error === GetSocialSDK.ConflictUser) {
handleConflict(conflictUser);
} else {
console.log('Failed to log into ' + userId);
}
});
Trusted Identities¶
A trusted identity is a an identity that GetSocial can verify and validate internally. We currently support 2 types of Trusted Identities: Custom (verified using a signed JSON Web Token) and Facebook (verified against their servers).
In the GetSocial Dashboard, you can also configure to only allow trusted identities. In this case, any identity that is not trusted will be rejected.
Add a Custom Trusted Identity¶
A Custom Trusted Identity is an identity that is added using a signed JSON Web Token. If you have your own backend, then this is the preferred way to add a custom identity, as it allows GetSocial to verify and trust the ID you are setting.
To add a trusted identity, you should generate, in your backend, a signed JWT using your App’s shared secret available in the GetSocial Dashboard.
The JWT header should be:
{
"alg": "HS256",
"typ": "JWT"
}
and the payload should include:
{
"sub": "your-user-id",
"iat": 15162390,
"exp": 1632471472
}
The final JWT signed with your-shared-secret
will look like this:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ5b3VyLXVzZXItaWQiLCJpYXQiOjE1MTYyMzkwLCJleHAiOjE2MzI0NzE0NzJ9.rXJSgFXYSqf3zHsLQ_oZB5SYKE_PkXgnjMlAJpbnKbY
Don’t expose your shared secret in your app
The signed JWT should be generated in your backend and then shared to your app to prevent exposing the shared secret to the public.
Trusted identities on SDK v7.6.0 and earlier
Full support for trusted identities was added on SDK v7.6.1, however you can still add a Trusted Identity in older versions by creating a custom identity with your UserId and the JWT as token.
fun onLoginSuccess() {
val userId = getCurrentUserId() // get user ID on your login provider
val accessToken = getJWTFromYourBackend()
val identity = Identity.trusted("my_auth_system", accessToken)
val currentUser = GetSocial.getCurrentUser()
if (currentUser == null) {
// you can't add identity before SDK is initialized
return
}
currentUser.addIdentity(identity, {
Log.d("CurrentUser", "Identity added successfully")
}, { conflictUser: ConflictUser ->
handleConflic(identity, conflictUser)
}, { error: GetSocialError ->
Log.d("CurrentUser", "Failed to add identity: $error")
})
}
let userId = getCurrentUserId() // get user ID on your login provider
let accessToken = getJWTFromYourBackend()
let identity = Identity.trusted(providerId: "my_auth_system", accessToken: accessToken)
GetSocial.currentUser()?.addIdentity(identity, success: {
print("Successfully logged into \(userId)")
}, conflict: { conflictUser in
self.handleConflict(identity: identity, conflictUser: conflictUser)
}, failure: { error in
print("Failed to log into \(userId)")
})
var userId = GetCurrentUserId(); // get user ID on your login provider
var accessToken = GetJWTFromYourBackend();
var identity = Identity.Trusted("my_auth_system", accessToken);
GetSocial.GetCurrentUser().AddIdentity(identity, () => {
Debug.Log("Successfully logged into " + userId);
}, (conflictUser) => {
HandleConflict(conflictUser);
}, (error) => {
Debug.Log("Failed to log into " + userId);
});
var userId = getCurrentUserId(); // get user ID on your login provider
var accessToken = getJWTFromYourBackend();
var identity = Identity.trusted('my_auth_system', accessToken);
var user = await GetSocial.currentUser;
user.addIdentity(
identity,
() => { print('Successfully logged into ' + userId)},
(conflictUser) => { handleConflict(conflictUser) },
(error) => { print('Failed to log into ' + userId)});
}
const userId = getCurrentUserId(); // get user ID on your login provider
const accessToken = getJWTFromYourBackend();
const identity = Identity.createTrustedIdentity('my_auth_system', accessToken);
const currentUser = await GetSocial.getCurrentUser();
currentUser.addIdentity(
identity,
() => { console.log('Successfully logged into ' + userId); },
(conflictUser) => { handleConflict(conflictUser); },
(error) => { console.log('Failed to log into ' + userId); }
);
const userId = getCurrentUserId(); // get user ID on your login provider
const accessToken = getJWTFromYourBackend();
const identity = GetSocialSDK.Identity.createTrustedIdentity('my_auth_system', accessToken);
const currentUser = GetSocial.getCurrentUser();
currentUser.addIdentity(identity)
.then(() => {
console.log('Successfully logged as ' + userId);
}, (error) => {
if (typeof error === GetSocialSDK.ConflictUser) {
handleConflict(error);
} else {
console.log('Failed to log into ' + userId);
}
});
);
Add Facebook Identity¶
To add a Facebook Identity, you should provide the token you got from Facebook SDK after user’s authentication.
This could be either a User Access Token or an Authentication Token if you are using Facebook Limited Login.
-
Integrate Facebook SDK into your app as described in the Official Guide for iOS, Android or Unity.
-
Add Facebook identity to GetSocial user. Sample code is below:
val accessTokenTracker = object: AccessTokenTracker() { override fun onCurrentAccessTokenChanged(oldAccessToken: AccessToken, currentAccessToken: AccessToken) { stopTracking() // stop tracking facebook access token changes as we don't need it anymore val currentUser = GetSocial.getCurrentUser() if (currentUser == null) { // you can't add identity before SDK is initialized // you can save the token to use it later accessToken = currentAccessToken return } currentUser.addIdentity(Identity.facebook(currentAccessToken), {}, {}, {}) } } accessTokenTracker.startTracking() LoginManager.getInstance().logInWithReadPermissions(this@MainActivity, listOf("email", "user_friends")) // we need "user_friends" permission to import list of Facebook friends to GetSocial Social Graph
let login = FBSDKLoginManager() login.loginBehavior = FBSDKLoginBehaviorBrowser /* we need "user_friends" permission to import list of Facebook friends to GetSocial Social Graph */ login.logIn(withReadPermissions: ["email", "user_friends"], fromViewController: self, handler: { result, loginError in if loginError == nil && result?.isCancelled == nil { let identity = Identity.facebook(accessToken: result?.token.tokenString) GetSocial.currentUser().addIdentity(identity, success: { print("Successfully logged into FB") }, conflict: { conflictUser in self.handleConflict(for: identity, conflictUser: conflictUser) }, failure: { error in print("Failed to log into FB") }) } })
FB.Init(() => { var permissions = new List<string>(){"public_profile", "user_friends"}; // We need "user_friends" permission to import list of Facebook friends to GetSocial Social Graph FB.LogInWithReadPermissions(permissions, result => { if (FB.IsLoggedIn) { var aToken = Facebook.Unity.AccessToken.CurrentAccessToken; var identity = Identity.Facebook(aToken.TokenString); GetSocial.GetCurrentUser().AddIdentity (identity, OnSuccess, OnError, OnConflict); } else { Debug.Log("User cancelled login"); } }); });
var fbIdentity = Identity.facebook(fbAcessToken); var user = await GetSocial.currentUser; user.addIdentity( fbIdentity, () => { print('Successfully logged into ' + fbIdentity)}, (conflictUser) => { handleConflict(conflictUser) }, (error) => { print('Failed to log into ' + fbIdentity)}); }
// We need "user_friends" permission to import list of Facebook friends to GetSocial Social Graph LoginManager.logInWithReadPermissions(['email', 'user_friends', 'public_profile']).then((result) => { if (result.isCancelled) { console.log('FB Login cancelled'); } else { AccessToken.getCurrentAccessToken().then((token) => { if (token != null) { const fbIdentity = Identity.createFacebookIdentity(token.accessToken); const currentUser = await GetSocial.getCurrentUser(); currentUser.addIdentity(fbIdentity, () => {}, (conflictUser) => {}, (error) => {}); } }); } }, (error) => { console.log('FB login failed with error: ' + error); });
// We need "user_friends" permission to import list of Facebook friends to GetSocial Social Graph FB.login(function (response) { if (response.status === 'connected') { const fbIdentity = GetSocialSDK.Identity.createFacebookIdentity(response.authResponse.accessToken); const currentUser = GetSocialSDK.GetSocial.getCurrentUser(); currentUser.addIdentity(fbIdentity); } else { console.log('FB login failed with status: ' + response.status); } }, {scope: 'public_profile,email,user_friends'});
For Facebook, we will retrieve the list of Facebook friends and import them to Social Graph, so you can get list of user’s friends through GetSocial.
GetSocial doesn’t automatically sync your Facebook profile info
Donβt forget to sync the display name and avatar of the GetSocial user with the values from Facebook. You can do it with a batch update to make it in one call.
Add Username Identity¶
If your app identifies users publicly using both, a display name (ie John D.
) and a username or handle (johndoe
), then we recommend using the username
identity provider. This provider can be used as a standalone, as a trusted identity, and/or in combination with other identities.
The benefits of using the username
identity is that usernames are unique, can be used to authenticate a user and are also searchable (none of the other identity providers are) when finding users.
To add a username
identity, you can just follow the steps to Add Identity or Add a Custom Trusted Identity but set username
as the identity provider providerId
and the user’s username as userId
.
We suggest not including any prefix like @
or #
in the user’s username and only add it in your UI when needed.
Handle Conflicts¶
Besides success
and failure
callbacks, addIdentity
has conflict
. Conflict happens when identity you’re trying to add is already attached to one of GetSocial users. It may happen when:
- User has already logged in on another device.
- User reinstalled the application.
- User cleared application data.
Depending on the user intention and your application logic, you can choose one of the following strategies to resolve the conflict.
Strategy 1: stay with current user and don’t add identity:
fun handleConflict(identity: Identity, conflictUser: ConflictUser) {
// Do nothing in onConflict and user will stay the same.
// Identity won't be added to any of the users.
}
func handleConflict(identity: Identity, conflictUser: ConflictUser) {
// Do nothing in onConflict and user will stay the same.
// Identity won't be added to any of the users.
}
void HandleConflict(Identity identity, ConflictUser conflictUser)
{
// Do nothing in onConflict and user will stay the same.
// Identity won't be added to any of the users.
}
handleConflict(Identity identity, ConflictUser conflictUser) {
// Do nothing in onConflict and user will stay the same.
// Identity won't be added to any of the users.
}
handleConflict(authIdentity, conflictUser) {
// Do nothing in onConflict and user will stay the same.
// Identity won't be added to any of the users.
}
handleConflict(conflictUser) {
// Do nothing and user will stay the same.
// Identity won't be added to any of the users.
}
Strategy 2: switch to conflict user:
fun handleConflict(identity: Identity, conflictUser: ConflictUser) {
// Call switchUser to replace current user with conflict one and add identity to conflict user.
// After the successful switch, current user and his referral data will be lost.
// To save the data: 1. copy data to intermediate variables; 2. save in to the conflict user properties after the successful switch.
GetSocial.switchUser(identity, { /** onSuccess **/ }, { /** onError **/ })
}
func handleConflict(identity: Identity, conflictUser: ConflictUser) {
// Call switchUser to replace current user with conflict one and add identity to conflict user.
// After the successful switch, current user and his referral data will be lost.
// To save the data: 1. copy data to intermediate variables; 2. save in to the conflict user properties after the successful switch.
GetSocial.switchUser(to: identity, success: {
print("Successfully switched user")
}, failure: { error in
print("Failed to switch user")
})
}
void HandleConflict(Identity identity, ConflictUser conflictUser)
{
// Call switchUser to replace current user with conflict one and add identity to conflict user.
// After the successful switch, current user and his referral data will be lost.
// To save the data: 1. copy data to intermediate variables; 2. save in to the conflict user properties after the successful switch.
GetSocial.SwitchUser(identity, completionCallback);
}
handleConflict(Identity identity, ConflictUser conflictUser) {
// Call switchUser to replace current user with conflict one and add identity to conflict user.
// After the successful switch, current user and his referral data will be lost.
// To save the data: 1. copy data to intermediate variables; 2. save in to the conflict user properties after the successful switch.
GetSocial.switchUser(identity).then(...);
}
handleConflict(identity, conflictUser) {
// Call switchUser to replace current user with conflict one and add identity to conflict user.
// After the successful switch, current user and his referral data will be lost.
// To save the data: 1. copy data to intermediate variables; 2. save in to the conflict user properties after the successful switch.
GetSocial.switchUser(identity);
}
handleConflict(conflictUser) {
// Logout
GetSocialSDK.Auth.logout();
// or notify about the error
console.log('This identity belongs to user: ', conflictUser.displayName);
}
Logout¶
If your users can log out of your app, you should log out of GetSocial user too. Otherwise it will stay the same and will have connection with another user that will login after.
fun onLogoutSuccess() {
// New anonymous will be created. If your current user is anonymous - it will be lost.
GetSocial.resetUser({ /** onSuccess **/, /** onError **/ })
}
func onLogoutSuccess() {
// New anonymous user will be created. If your current user is anonymous - it will be lost.
GetSocial.resetUser(success: successCallback, failure: failureCallback)
}
void OnLogoutSuccess()
{
// New anonymous will be created. If your current user is anonymous - it will be lost.
GetSocial.ResetUser(OnSuccess, OnError);
}
onLogoutSuccess() {
// New anonymous will be created. If your current user is anonymous - it will be lost.
GetSocial.resetUser().then(...);
}
onLogoutSuccess() {
// New anonymous will be created. If your current user is anonymous - it will be lost.
GetSocialUser.reset();
}
onLogoutSuccess() {
// The session is removed and it's not possible to use the GetSocial services anymore
// For security purposes, there are no anonymous users in web
}
Subscribe to GetSocial user changes to be notified about logout events too.
Handle Multiple User Identities¶
You may want to connect multiple identities (login with Facebook and Google at the same time). It will allow to log into that user with different auth providers.
Your user may have any number of different identities attached for different login providers, but only one identity for each provider.
You already know how to add identity. Once it is successfully added, you can log in using that identity.
To remove identity from user:
val providerId = "my_auth_system"
val currentUser = GetSocial.getCurrentUser()
if (currentUser == null) {
// you can't remove identity before SDK is initialized
return
}
currentUser.removeIdentity(providerId, { /** onSuccess **/, /** onError **/ })
let providerId = "my_auth_system"
GetSocialUser.removeIdentity(providerId: providerId, success: success, failure: failure)
var providerId = "my_auth_system";
var currentUser = GetSocial.GetCurrentUser();
if (currentUser == null)
{
// you can't remove identity before SDK is initialized
return
}
currentUser.RemoveIdentity(providerId, OnSuccess, OnError);
var providerId = "my_auth_system";
var currentUser = await GetSocial.currentUser;
if (currentUser == null) {
// you can't remove identity before SDK is initialized
return
}
currentUser.removeIdentity(providerId).then(...);
const providerId = 'my_auth_system';
const currentUser = await GetSocial.getCurrentUser();
currentUser.removeIdentity(providerId).then(() => {
console.log('Successfully remove identity');
}, (error) => {
console.log('Failed remove identity, error:' + error);
});
const providerId = 'my_auth_system';
const currentUser = GetSocialSDK.GetSocial.getCurrentUser();
currentUser.removeIdentity(providerId)
.then(() => {
console.log('Successfully remove identity');
}, (error) => {
console.log('Failed remove identity, error:', error);
});
To get all user identities:
val identities = GetSocial.currentUser()?.getIdentities()
let identities = GetSocial.currentUser()?.identities
var identities = GetSocial.GetCurrentUser().Identities;
var currentUser = await GetSocial.currentUser
var identities = currentUser.identities;
const currentUser = await GetSocial.getCurrentUser();
const identities = currentUser.identities;
const currentUser = GetSocialSDK.GetSocial.getCurrentUser();
const identities = currentUser.identities;
where key
is providerId
and value
is userId
for that provider.
Change Logged In User¶
If you want to switch from one logged in user to another, do Logout first and then Login with a new user.
Warning
Don’t forget to do the logout, it is important to keep your user connected with proper GetSocial user, so you will receive correct analytics and referral data.
Subscribe to User Lifecycle Changes¶
User change handler is invoked when:
- SDK got initialized;
- You successfully switched user as in Strategy 2 of Handle Conflict section;
- You successfully reset user.
Not provided by Web SDK
This listener is not provided by the Web SDK. There is no switchUser method and a listener for the initialization can be set with addOnInitializedListener.
Set your custom event handler somewhere on the start of your application:
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Setup GetSocial
val listenerId = GetSocial.addOnCurrentUserChangedListener { newUser: CurrentUser ->
Log.d("CurrentUser", "Is user anonymous? ${newUser.isAnonymous}")
Log.d("CurrentUser", "What's user's avatar? ${newUser.avatarUrl}")
Log.d("CurrentUser", "What's user's name? ${newUser.displayName}")
Log.d("CurrentUser", "List of user's identities: ${newUser.identities}")
}
...
// You can remove the listener later
GetSocial.removeOnCurrentUserChangedListener(listenerId)
}
}
class ViewController: UIViewController {
...
func viewDidLoad() {
super.viewDidLoad()
...
let listenerId = GetSocial.addOnCurrentUserChangedListener { currentUser in
print("User is anonymous: \(currentUser.isAnonymous ? "Yes" : "No")")
print("User's displayName: \(currentUser.displayName)")
print("User's avatarURL: \(currentUser.avatarUrl)")
print("User's identites: \(currentUser.identities)")
}
...
// You can remove the listener later
GetSocial.removeOnCurrentUserChangedListener(listenerId)
}
}
var listenerId = GetSocial.AddOnCurrentUserChangedListener((currentUser) => {
Debug.Log("User is anonymous: " + currentUser.IsAnonymous);
Debug.Log("User's displayName: " + currentUser.DisplayName);
Debug.Log("User's avatarURL: " + currentUser.AvatarUrl);
Debug.Log("User's identites: " + currentUser.Identities);
});
// You can remove the listener later
GetSocial.RemoveOnCurrentUserChangedListener(listenerId);
GetSocial.addOnCurrentUserChangedListener((currentUser) => {
print('User is anonymous: $currentUser.isAnonymous'),
print('User displayName: $currentUser.displayName'),
print('User avatarURL: $currentUser.avatarUrl'),
print('User identites: $currentUser.identities'),
});
GetSocial.addOnCurrentUserChangedListener((currentUser) => {
console.log('User is anonymous: ' + currentUser.isAnonymous);
console.log('User displayName: ' + currentUser.displayName);
console.log('User avatarURL: ' + currentUser.avatarUrl);
console.log('User identites: ' + currentUser.identities);
});
Next Steps¶
Well-done! Your user is set up, see what to do next: