Guest Users

Last Edit: Mar 03 2020

Guest sessions can be created client-side and do not require any server-side authentication.

Guest users have a limited set of permissions. You can read more about how to configure permissions here. You can create a guest user session by using setGuestUser instead of setUser.


await client.setGuestUser({ id: 'tommaso' });
                    

// Not supported yet
                    

// Create a user, when he/she was logged in.
let user = User(id: "bender", name: "Bender", avatarURL: URL(string: "https://bit.ly/321RmWb")!)

// Setup the current user and guest token.
Client.shared.set(user: user, token: .guest)
                    

val userId = "user-id"
val userName = "bender"
client.getGuestToken(userId, userName).enqueue {
    val token = it.data().token
    val user = it.data().user

    client.setUser(user, token)
}
                    
The user object schema is the same as the one described in the Setting the user portion of the docs.