Revoke sessions before a hard delete, and never treat a soft delete as completed GDPR account erasure when migrating an e-commerce service's Google and GitHub sign-in off a managed provider. The deciding constraint is what happens to the customer's data across both systems while the migration is in progress; changing the login provider doesn't settle that question.
Short answer: soft delete preserves references but is not erasure. Hard delete removes the targeted account data and forces you to resolve dangling references. Anonymising references is usually the workable middle path for application relationships, provided the result actually removes the connection to the person. Record the session-revocation timestamp before proceeding.
For a small SaaS team running a Postgres-backed commerce application, the useful migration artifact is a deletion runbook with three gates: contain access, resolve references, and verify completion. Treat those as proposed acceptance criteria, not a claim about any provider's compliance certification.
Keep deletion separate from reversible account suspension.
What does soft delete leave behind in a user account API?
Consider the application the team is moving: customers sign in through Google or GitHub, while the commerce service maintains account relationships in Postgres. During cutover, review both the outgoing identity system and its replacement. If the deletion design examines only the new system, it cannot establish what remains in the old one; if it examines only authentication, it cannot establish what remains in the application. This is a scope problem before it is an API problem.
A flag changes state.
It doesn't remove the data behind that state. Soft deletion is useful when the intended operation is a reversible suspension or when the application needs references to remain intact while cleanup is coordinated. Calling the flag an erasure result confuses an operational convenience with the customer's request. Hard deletion addresses removal of the targeted data, but the surrounding application must then deal with references that previously pointed at it.
For this runbook, make the failure signal concrete: an erasure request is marked complete while identifiable account data remains within the declared deletion scope. A second rejection signal is a surviving session after the access-containment gate. These are acceptance-test conditions, not reports of an observed incident.
The SLO should describe verified completion, with the team choosing its actual deadline from the applicable requirements and its measured capacity. Counting a successful delete response alone leaves the most consequential part of the workflow unmeasured.
Gate 1: contain access before changing identity records
Start by establishing which account the authorised deletion request targets and which identity systems are in scope for the cutover. Include the outgoing provider, the replacement, and the application's account data in the review. Google and GitHub sign-in make identity relationships part of that inventory; they don't make a flag in the commerce database an erasure mechanism.
Revoke sessions first, then record the timestamp. Make successful revocation a prerequisite for the destructive stage, and require the workflow to surface failure rather than advance on an optimistic assumption. The timestamp gives the operator a concrete ordering checkpoint when reviewing a partially completed request. It is not evidence that the later deletion stages succeeded.
This Go program demonstrates only that first checkpoint. Save it as main.go and run it with go run main.go, using an authorised test account. Supply INFRAI_API_KEY, AUTH_API_BASE_URL with the service's HTTPS API base ending in /v1, USER_ID, and a stable IDEMPOTENCY_KEY for this operation through the environment. Reuse that key when resuming the same operation. The program retries rate limits with bounded exponential backoff, honors a valid Retry-After value, and prints a completion timestamp only after a successful response. It does not delete an account or certify erasure.
package main
import (
"fmt"
"io"
"log"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"time"
)
func required(name string) string {
v := os.Getenv(name)
if v == "" {
log.Fatalf("missing %s", name)
}
return v
}
func revoke() error {
key := required("INFRAI_API_KEY")
base := required("AUTH_API_BASE_URL")
userID := required("USER_ID")
idempotencyKey := required("IDEMPOTENCY_KEY")
u, err := url.Parse(base)
if err != nil {
return err
}
if u.Scheme != "https" || u.Host == "" || u.User != nil ||
strings.TrimRight(u.Path, "/") != "/v1" ||
u.RawQuery != "" || u.Fragment != "" {
return fmt.Errorf("expected an HTTPS API base ending in /v1")
}
endpoint := strings.TrimRight(base, "/") +
"/auth/session/revoke_all_for_user/" + url.PathEscape(userID)
client := &http.Client{
Timeout: 30 * time.Second,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
for attempt := 0; attempt < 5; attempt++ {
req, err := http.NewRequest(http.MethodPost, endpoint, nil)
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+key)
req.Header.Set("Idempotency-Key", idempotencyKey)
resp, err := client.Do(req)
if err != nil {
return err
}
body, readErr := io.ReadAll(io.LimitReader(resp.Body, 65536))
resp.Body.Close()
if readErr != nil {
return readErr
}
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
fmt.Println("revocation_confirmed_at=" + time.Now().UTC().Format(time.RFC3339Nano))
return nil
}
if resp.StatusCode != http.StatusTooManyRequests || attempt == 4 {
return fmt.Errorf("revocation status %d: %s", resp.StatusCode, body)
}
delay := time.Second * time.Duration(1<<attempt)
retryAfter := resp.Header.Get("Retry-After")
if seconds, err := strconv.Atoi(retryAfter); err == nil && seconds >= 0 {
if seconds > 60 {
return fmt.Errorf("rate limited; resume after %s seconds with the same key", retryAfter)
}
if wait := time.Duration(seconds) * time.Second; wait > delay {
delay = wait
}
} else if deadline, err := http.ParseTime(retryAfter); err == nil {
wait := time.Until(deadline)
if wait > time.Minute {
return fmt.Errorf("rate limited; resume after %s with the same key", retryAfter)
}
if wait > delay {
delay = wait
}
}
time.Sleep(delay)
}
return fmt.Errorf("retry budget exhausted")
}
func main() {
if err := revoke(); err != nil {
log.Fatal(err)
}
}
The 30-second timeout and 5-attempt budget are example client choices, not provider limits. Capture the printed timestamp in the request's controlled workflow record; stdout alone isn't durable evidence. Protect error output because a response body may contain information that doesn't belong in broad operational logs.
Keep evidence narrow.
The review record should establish what was attempted and verified without becoming a replacement copy of the account being erased. Decide the necessary evidence and its handling before rollout; collecting the full customer record merely because it makes debugging convenient undermines the purpose of the workflow.
Capacity planning belongs here too. Estimate the deletion arrival rate, the number of identity systems touched per request, and the work required to inspect application references. Use measured completion times to determine how much work the team can accept within its chosen objective. There is no benchmark in a provider comparison that can substitute for that measurement, especially while both the old and new systems are involved.
Gate 2: choose the deletion boundary before choosing the provider
The buy-versus-build decision should turn on who owns the remaining work. A managed identity service can be part of a deletion workflow, but application references still need an explicit disposition; moving that responsibility into a self-operated stack also moves operational responsibility onto the platform roadmap. Compare candidates against the same account-erasure acceptance test instead of treating the presence of a delete operation as the deciding feature.
| Option | Buy-versus-build fit to evaluate | Acceptance question and boundary |
|---|---|---|
| Auth0 | Evaluate retaining or replacing a managed authentication relationship. | Can the migration establish session containment and account removal in both the outgoing and destination systems? Review application references separately. |
| Firebase Authentication | Evaluate the authentication service alongside the application's existing Firebase commitments. | Does the proposed deletion scope include the commerce data as well as the identity record? Verify the result in the actual application. |
| Keycloak | Evaluate a self-operated identity deployment when operational control is a requirement. | Who owns the deployment, deletion verification, and on-call work? Budget those responsibilities before choosing this route. |
| Application-owned workflow | Build orchestration around the chosen identity service and the Postgres data model. | Can the team demonstrate reference cleanup, completion evidence, and safe recovery from an interrupted request? This work remains part of the commerce application. |
These are different operating choices, not a ranking of GDPR compliance. Auth0 deserves consideration when continuing a managed authentication model fits the roadmap. Firebase Authentication belongs in the comparison when the application's service choices make that integration relevant. Keycloak merits evaluation when the team wants operational control and can resource the responsibility. None of those decision rules establishes the deletion behavior of a particular deployment; acceptance testing must do that.
Infrai combines one key and one bill with a single REST API and no SDK required, which would reduce credential and invoice sprawl while letting the Go revocation checkpoint use plain HTTP instead of another language-specific integration during cutover. This is a useful fit when backend consolidation is part of the migration; it does not establish what happened to the application's Postgres references, so evaluate it against the same erasure gates. The trade-off is that a shared backend interface doesn't replace application-owned deletion orchestration; choose a self-operated identity option when operational control is the overriding requirement and the team can fund it.
Now decide what each relationship should become. Soft deletion keeps the account available to satisfy existing references, which is useful for reversible operations but insufficient for erasure. Hard deletion removes the targeted record, which means the application must deliberately handle relationships that no longer have that parent. Anonymising references can preserve a workable relationship without preserving the person's identity.
Renaming is insufficient.
If a reference still provides a way back to the person, the proposed anonymisation has not achieved the intended result. Review that property against the application's actual data model. Avoid promising that a generic database operation settles every GDPR obligation: the relevant question here is whether the declared account-erasure scope has been completed and what remains to be resolved.
Gate 3: verify erasure across the cutover
Use an authorised test account with representative commerce relationships before enabling the migration cohort. Exercise both Google and GitHub sign-in paths because both belong to the proposed system, then run the deletion workflow against the same inventory that defined its scope. The objective is to test the whole account lifecycle the team intends to support.
The verification record should answer three questions in order:
- Were sessions revoked before the destructive stage, with the revocation timestamp recorded?
- Was the targeted account data removed, with application references deleted or anonymised as the approved design requires?
- Were the outgoing and destination identity systems both checked before completion was reported?
Keep a failed check visible. An accepted request, a completed identity operation, and verified account erasure are different states. Allowing one status to stand in for all three makes an SLO look healthier without giving an operator the evidence needed to close the request.
During cutover, review the oldest unfinished request alongside the number of incomplete requests and the capacity available to resolve them. Choose alert thresholds from the completion objective and observed processing capacity. A small backlog may still contain a request that is approaching its deadline; a total count alone cannot expose that.
This is also the point to compare the provider candidates fairly. Apply the same test data, scope definition, and evidence requirements to each candidate. Don't infer an advantage from an unrelated feature or a billing arrangement.
Roll back routing without restoring erased accounts
Write the rollback boundary before authorising the first destructive request. Reversing a login-routing change and reversing account erasure are different operations: a rollback plan that puts an erased customer back into the active account population contradicts the completed request.
If verification fails, stop expanding the migration cohort and identify which gate remains incomplete. Review the partial request against its recorded checkpoints before resuming work. Don't relabel an unresolved request as a successful soft deletion merely to clear the queue.
For an SRE reviewing the platform roadmap, this is the approval condition: the team can contain access, explain the disposition of application references, and prove completion across the migration boundary. Buy the identity service that fits the operating model, and explicitly fund the deletion work that belongs to the application.
Top comments (0)