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 account, MailboxRefreshToken refreshToken, CancellationToken cancellationToken)
Parameters
accountMailAccountIdThe account the token acts for.
refreshTokenMailboxRefreshTokenThe token to store. The caller keeps ownership of it.
cancellationTokenCancellationTokenPropagates 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.