Get Snap Profile Data
Requesting user data fetches below information
  • Bitmoji Avatar attached to the logged in profile
  • Display Name
  • External ID which is unique and specific to this app scope
1
SnapchatKitManager.RequestUserData(OnRequestUserDataComplete);
Copied!
Make sure you enable the required scopes to get the above information in settings.
Get the details of the user data in the callback
1
private void OnRequestUserDataComplete(SnapchatUserInfo info, string error)
2
{
3
string message = "";
4
5
if (string.IsNullOrEmpty (error))
6
{
7
message = "Display Name : " + info.DisplayName;
8
message += " " + "Avatar URL : " + info.BitmojiAvatar;
9
message += " " + "External ID : " + info.ExternalIdentifier;
10
}
11
else
12
{
13
message = error;
14
}
15
Debug.Log(message);
16
}
Copied!
Example
1
using VoxelBusters.SnapchatKit;
2
using VoxelBusters.SnapchatKit.Common.Utility;
3
4
private void RequestUserData()
5
{
6
if(SnapchatKitManager.IsLoggedIn())
7
{
8
SnapchatKitManager.RequestUserData(OnRequestUserDataComplete);
9
}
10
else
11
{
12
// Finsish login and come back to request user data
13
}
14
}
15
16
private void OnRequestUserDataComplete(SnapchatUserInfo info, string error)
17
{
18
string message = "";
19
20
if (string.IsNullOrEmpty (error))
21
{
22
message = "Display Name : " + info.DisplayName;
23
message += " " + "Avatar URL : " + info.BitmojiAvatar;
24
message += " " + "External ID : " + info.ExternalIdentifier;
25
26
DownloadTexture _newDownload = new DownloadTexture(new URL(info.BitmojiAvatar), true, true);
27
_newDownload.OnCompletion = (Texture2D _texture, string _error)=>{
28
29
Debug.Log(string.Format("[DownloadAvatar] Texture download completed. Error= {0}.", _error.GetPrintableString()));
30
//Access downloaded texture from _texture here.
31
};
32
33
// Start the request
34
_newDownload.StartRequest();
35
}
36
else
37
{
38
message = error;
39
}
40
Debug.Log(message);
41
}
42
Copied!
Last modified 2yr ago
Copy link