Table of Contents

Method SaveTokenAsync

Namespace
MailFathom.Application.Accounts
Assembly
MailFathom.Application.dll

SaveTokenAsync(MailAccountId, MailboxRefreshToken, CancellationToken)

Stores the refresh token for one account, replacing whatever was stored before.

Task SaveTokenAsync(MailAccountId accountId, MailboxRefreshToken refreshToken, CancellationToken cancellationToken)

Parameters

accountId MailAccountId

The account the token acts for.

refreshToken MailboxRefreshToken

The token to store. The caller keeps ownership of it.

cancellationToken CancellationToken

Propagates caller cancellation.

Returns

Task

A task that completes after durable storage.

Remarks

Only the newest token is kept. An authorization server that rotates invalidates the token it replaced, so a previous one is not a fallback but a credential that no longer works, and keeping it would widen what a disclosure of the database exposes for nothing. The write is idempotent in the account, so storing the same token twice — two replicas refreshing at once, a retried request — leaves one row rather than a conflict.