Account Deletion
Allow end-users to initiate account deletion within the apps.
Last updated
Allow end-users to initiate account deletion within the apps.
Last updated
In Oct 2021, Apple announced that all apps allowing users to create accounts should also provide ways for them to initiate account deletion within the apps, starting from January 31, 2022. It is also a good design to give your end-users more control over their data.
On Jan 22, 2022 Apple decided to extend the deadline to June 30 2022.
In the pre-built User Settings page, you can show a button for the end-users to initiate account deletion. Users can access the Delete Account button under Advanced Settings in the User Settings page when you enable Account Deletion on your project.
Enable this button in the Advanced -> Account Deletion page in the Portal
Note that if you enable this feature, you have to prepare for encountering invalid session every time your users close User Settings in your mobile apps. If your users unfortunately decided to delete their account in User Settings, all their sessions will become invalid immediately.
You must verify the validity of the session every time the User Settings is closed. The open
method in the SDK is blocking. You can verify if the user session is still valid when the method resolves. Here is an example with the React Native SDK:
You can now open the account deletion directly from Authgear SDKs. The account deletion page will be opened in a WebView.
The following code examples show how to open the account deletion page from Authgear SDKs:
When the end-user has initiated the account deletion, their account will be deactivated and scheduled for deletion after the grace period.
Deactivated users are always disabled. They will not be able to complete the authentication process. The is_deactivated
status signal that the is_disabled
status was turned true
by the end-user themselves rather than the admin.
You can set the grace period for how long the user account will be deactivated before deleted from the system. The default value is 30 days, you can choose between 1 to 180 days.
An end-user account can also be deleted using the Portal. In the User Management page, click the Remove User button to remove them immediately or schedule the deletion.
Alternatively, if you did not enable the "Delete Account" button in User Settings, you can implement the button in your app by yourself. You can schedule a deletion or delete immediately.
Your backend server can invoke the mutation scheduleAccountDeletion
with the Admin API to initiate the account deletion.
Here is an example:
GraphQL
Your backend server can invoke the mutation scheduleAccountDeletion
with the Admin API to initiate the account deletion.
Here is an example:
GraphQL
You may listen to the following events to integrate the deletion behavior to your apps.
Non-blocking events
user.disabled
user.reenabled
user.deletion_scheduled
user.deletion_unscheduled
user.deleted
Blocking event
user.pre_schedule_deletion
See the event details in Webhooks.