Digital Services Act Notifications
Understand Digital Services Act compliance requirements for publishing games with Unity Authentication in the European Union.
Read time 2 minutesLast updated 18 hours ago
Minimum SDK version: 3.3.0
To comply with the Digital Services Act, which takes full effect on February 17, 2024, you must integrate with the new Notifications APIs. Refer to our DSA compliance efforts page for more information. When a DSA notification is sent to a user, it will contain the following notable fields:- : A case identifier to allow the player to request more details on the notification.
CaseId - : The Cloud Project identifier to allow the player to request more details on the notification.
ProjectId - : The content of the notification to display to the player, for example:
MessageYour account or content has been affected by DSA action. Retrieve details & appeal via: [Link] (Case ID [insert] & Player ID [insert] needed). - : Timestamp for when the notification was created. Used to identify new notifications are available for the player.
CreatedAt
Notifications for signed in player
Every time a player successfully signs in, the Authentication SDK validates if there are any notifications available for that player and populates theLastNotificationDate- Check if the field is not null after every successful sign in. If it is not null, then there are notifications available for that player.
AuthenticationService.Instance.LastNotificationDate - Confirm if the is greater than the value you stored for the last notification the player read.
LastNotificationDate - Retrieve the player's notifications by calling the method.
GetNotificationsAsync - Display the notifications to the player. (The notifications are available in the return value of the method and are also cached in the
GetNotificationsAsyncfield.)Notifications - When the player reads a notification you must store the greater value between that notification's value and the stored value for the player's last read notification.
CreatedAt
Notifications for a restricted player
When a player tries to sign in and fails due to them being restricted (for example, they have been banned or disabled), anAuthenticationExceptionNotifications- Check if the exception is an , after every failed sign in attempt.
AuthenticationException - Confirm that the field is not null.
Notifications - Display the notifications to the player.
async Task SignInWithNotifications(){ List<Notification> notifications = null; try { // Sign the Player In, Anonymously in this example await AuthenticationService.Instance.SignInAnonymouslyAsync(); // Verify the LastNotificationDate var lastNotificationDate = AuthenticationService.Instance.LastNotificationDate; // Retrieve the last notification read createdAt date from storage long storedNotificationDate = GetLastNotificationReadDate(); // Verify if the LastNotification date is available and greater than the last read notifications if (lastNotificationDate != null && long.Parse(lastNotificationDate) > storedNotificationDate) { // Retrieve the notifications from the backend notifications = await AuthenticationService.Instance.GetNotificationsAsync(); } } catch (AuthenticationException e) { // Read notifications from the banned player exception notifications = e.Notifications; // Notify the player with the proper error message Debug.LogException(e); } catch (Exception e) { // Notify the player with the proper error message Debug.LogException(e); } if (notifications != null) { // Display notifications }}void OnNotificationRead(Notification notification){ // Retrieve the last notification read createdAt date from storage var storedNotificationDate = GetLastNotificationReadDate(); var notificationDate = long.Parse(notification.CreatedAt); if (notificationDate > storedNotificationDate) { SaveNotificationReadDate(notificationDate); }}void SaveNotificationReadDate(long notificationReadDate) { // Store the notificationReadDate, e.g.: PlayerPrefs}long GetLastNotificationReadDate() { // Retrieve the notificationReadDate that was stored in SaveNotificationReadDate, e.g.: PlayerPrefs ...}