AspNetCoreIssue27088
Workaround for ASP.NET [Issue 27088]: Configure email OTP lifetime with custom providers in this .NET 8 solution.
Install / Use
/learn @AsifulNobel/AspNetCoreIssue27088README
Workaround for ASP.NET Issue 27088
This repository provides a workaround for ASP.NET Issue 27088 where the token provider is not yet configurable. The workaround introduces custom providers to enable developers to configure the email OTP (One-Time Password) lifetime. The default lifetime in ASP.NET is 9 minutes.
Usage
- Add the classes in the
CustomTotpTokenProvidersdirectory to your Auth project. - Locate the place in your project where
builder.Services.AddIdentityis defined (usually inStartup.csor an extension class). - After finding the location, add the following code after
identityBuilder.AddDefaultTokenProviders().
.AddTokenProvider(TokenOptions.DefaultEmailProvider, typeof(CustomEmailTokenProvider<>).MakeGenericType(identityBuilder.UserType))
Import the namespace where CustomEmailTokenProvider is located.
To use the token provider, configure the email token lifetime by adding the following code (before using the provider):
services.AddSingleton(new CustomEmailTokenProviderOptions
{
TokenLifespanInSeconds = 120
});
This can be added in Startup.cs or wherever you are configuring dependencies. The provider options have been configured as singleton arbitrarily.
Unit Tests
Unit tests for the email token provider can be found in the CustomTotpTokenProviders.Tests project.
Note
The solution was built with .NET 8.
Related Skills
node-connect
338.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
338.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.6kCommit, push, and open a PR
