Login & Logout

Learn how to login to snapchat and logout

Login Status

Check if user is already logged into Snapchat service. This returns true if user is already logged in and you don't need to login again.

using VoxelBusters.SnapchatKit;

public void IsLoggedIn()
{
    bool isLoggedIn  =  SnapchatKitManager.IsLoggedIn();
    string message  = isLoggedIn ? "User logged in!" : "User not logged in yet!";
    Debug.Log(message);
}

Login

This opens Snapchat app and asks user to allow access. Capture the login status in the callback.

using VoxelBusters.SnapchatKit;

public void Login()
{
    SnapchatKitManager.Login(OnLoginComplete);
}

private  void  OnLoginComplete(bool  success,  string  error)  
{  
    string  message  =  success  ?  "Successfully  Logged  In"  :  "Failed  Logged  In  :  "  +  error;  
    Debug.Log(message);  
}

Logout

This logouts from the snapchat service. Post this operation until you login, you can share any content.

using VoxelBusters.SnapchatKit;

public void Logout()
{
    SnapchatKitManager.Logout(OnLogoutComplete);
}

private  void  OnLogoutComplete(bool  success,  string  error)  
{  
    string  message  =  success  ?  "Successfully  Logged  Out"  :  "Failed  Logged  Out  :  "  +  error;  
    Log(message);  
}

Last updated