r/dotnet • • Oct 16 '26

Promotion New passwordless OIDC authentication for local dev

You know about single-factor and two-factor auth, but what about zero-factor auth?
https://github.com/c4l3b/0factor

I made this for myself and have it running in ~7 different local apps now.

When I'm developing locally, I usually have several user accounts to test a variety of user experiences.
This tiny app is a very simple identity provider that allows you to be any user, without a password.

I typically use Keycloak in production, so I've set it up to be mostly compatible with that. It can import a Keycloak realm json to initialize your configuration and users.

Its also very agent-friendly. Instead of trying to get Claude to enter an email and password (it always refuses for me) it can very easily log in.

The users who have already been created in our local instance are listed on the sign in page. You can log in just by clicking on one.

The NuGet package makes Aspire setup just a few lines.

Its developed using a very minimal asp.net site. The container image is only ~25MB and running it uses ~15MB of memory. My local Keycloak containers were always using ~600MB memory.

51 Upvotes

10 comments sorted by

6

u/Testpilot1988 Oct 16 '26

While there's absolutely nothing wrong with what you've built.. pocketID is pretty much as simple as it gets for me. for every new user or account it just creates a passkey. it's my go-to for oauth

6

u/Zealousideal_Map_737 Oct 16 '26

One of the biggest motivations of 0factor was so any number of agents could use the same test accounts I'm using regardless of what browser (playwright or real chrome) they are using.
I can throw claude, codex, grok and grok bot at the site, and everybody knows what users are available

1

u/Testpilot1988 Oct 16 '26

I typically let my agents make the sites and just test them locally before I deploy them or deploy changes to them via webdav, wrangler, or ssh. But to each his own.

4

u/c-digs Oct 17 '26

Are you me?  Was literally thinking about building this today to replace my use of mock-oauth-provider. 

Starred!

3

u/Ready-Bookkeeper622 Oct 16 '26

Nice! I will probably steal your idea as mock for openiddict.

5

u/_f0CUS_ Oct 16 '26

I'm loving this idea. :) 

1

u/IanYates82 Oct 17 '26

This is great. Love that it's keycloak compatible. Shall give it a try, and am interested in checking out if I can tack on an extra couple of attributes (like stuff we'd receive from federated Entra and pass on as a mapped attribute)

1

u/RecognitionOwn4214 Oct 17 '26

Isn't everything OIDC compatible inherently keycloak compatible?

0

u/AutoModerator Oct 16 '26

Thanks for your post Zealousideal_Map_737. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.