Auth0 as ASP.NET Core External Login Provider

This may sound a little strange at first, but bear with me…

I have implemented Auth0 on my site which is now my IaaS provider. Utilizing it as well as a custom CRM for the user profile (orders, licensing, etc…) this is a complete “account”. Let’s call this “Fabrikam ID”.

Now, I am creating a a multi-tenant SaaS app, where I utilize a single database per tenant. This database is using ASP.NET Core 3 Identity.

My thinking is users can then log on with a local user account in the DB, or “Fabrikam ID” and I will store that as an External Login Provider, piggy backing off the way MS does this with Facebook, Google, etc… letting it do the heavy lifting from that end.

Basically, wanted to see if anyone has done this already and if it worked out well? I’m thinking this should theoretically work out, but can’t find much about custom External Login providers and was just going to dig through Microsoft’s Facebook, Google, Twitter code.

Thanks!

In case anyone attempts this, this turned out to be shockingly easy and works very well. Basically allows for logging into an ASP.NET Core app with either local user accounts or an Auth0 connection with very minimal code with what’s already built into ASP.NET Core Identity. If anyone is interested I’ll post the code.

1 Like

Glad you have figured it out and thanks for sharing with the rest of us!

@rev23dev Can you post the code? I am now struggling with this topic.

Hi @marek-urbanowicz. I have posted to GitHub for you. I hope it helps. Keep in mind I target ASP.NET Core 3.1. If you target anything prior to 3.0 this will not work due to changes they made in the OAuth library that removed Netwonsoft.Json dependencies and replaced with System.Text.Json.

https://github.com/REV23/REV23AspNetCoreAuth0

Let me know what you think :slight_smile:

1 Like

Thanks a lot for that knowledge-sharing @rev23dev!

1 Like

Hi,

appreciate it, but this is not what I am looking for.
I do not want to keep local accounts, Auth0 supposes to be only one provider and I only need to get some user data

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.