Skip to content

MojoAuth/Umbraco-MojoAuth-OpenIdConnect-Example

Repository files navigation

Umbraco OpenID Connect example package

This example shows how OpenID Connect can be used for members in Umbraco. It's a complete Umbraco solution with a SQLite database. Everything is already configured correct so you can just download the project and run it.

It's based on the external login providers documentation:
https://docs.umbraco.com/umbraco-cms/reference/security/external-login-providers

There are two versions of this example. The v13 version can be found in Umbraco-OpenIdConnect-Example.Web, which references Umbraco-OpenIdConnect-Example.Core. The v14+ version has been completely rebuilt and can be found in Umbraco-OpenIdConnect-Example-v14+, offering full compatibility with Umbraco v14 and above.

Backoffice credentials:

Username [email protected]
Password AKXT9fJGqBvKCVK5TqNZ

External member credentials:

Username [email protected]
Password juSp#&uf4a+omLkigIto

Tip

I also created a fork of the Umbraco Delivery API - member auth demo. It adds support for external login providers. See this pull request for all the changes. You can also find more info in this blog.

Getting started

You can watch a getting started video here: https://youtu.be/cklH7DtRDIQ

Online presentation

You can watch my online presentation here: https://youtu.be/I4ysh-czrYk

Important files

All important files that are used for this setup are in the Umbraco-OpenIdConnect-Example.Core project.

  1. OpenIdConnectMemberExternalLoginProviderOptions.cs
    This file is used to setup the auto link options.
  2. UmbracoBuilderExtensions.cs
    Extensions used to setup OpenID Connect and the related events.
  3. ExternalLogoutController.cs
    A new controller used for logout on the external login provider.

Short demo

Umbraco OpenID Connect demo

MojoAuth Integration

This project now demonstrates integration with MojoAuth, an easy-to-use, passwordless-first authentication platform that also supports standard OpenID Connect (OIDC) flows for seamless member login within Umbraco.

What is MojoAuth?

MojoAuth provides:

  • Hosted Login Page – Ready-made, customizable login experience
  • OpenID Connect Support – Standards-based authentication and authorization
  • Passwordless Options – Email magic links / OTP and other frictionless methods
  • Secure Token Handling – Follows OIDC and OAuth 2.0 best practices
  • Simple Configuration – Minimal setup to get running quickly

Configuration in this Example

The OpenIdConnect section inside the appsettings.json files is prepared for MojoAuth. Replace the placeholder values with those from your MojoAuth OIDC application:

"OpenIdConnect": {
	"MetadataAddress": "https://{project name}.auth.mojoauth.com/.well-known/openid-configuration",
	"ClientId": "{mojoauth application client id}",
	"ClientSecret": "{mojoauth application client secret}",
	"LogoutUrl": "https://{project name}.auth.mojoauth.com/v2/logout",
	"ReturnAfterLogout": "https://localhost:44342/"
}

Where {project name} is the MojoAuth tenant / project slug created in your MojoAuth dashboard.

Steps to Use MojoAuth with Your Own Umbraco Site

  1. Create / log into your account at: https://dashboard.mojoauth.com
  2. Navigate to Applications → Create OIDC Application.
  3. Note the Client ID and Client Secret.
  4. Set the Redirect / Callback URL to your Umbraco external sign-in endpoint (e.g. https://localhost:44342/umbraco-signin-oidc).
  5. (Optional) Configure Post Logout Redirect URL to match ReturnAfterLogout.
  6. Copy the Issuer (it follows https://{project name}.auth.mojoauth.com).
  7. Update both appsettings.json files (for v13 and v14+) with your values.

Running the Demo with MojoAuth

  1. Restore & build the solution.
  2. Update configuration with your MojoAuth credentials.
  3. Start the site and browse to a page containing the login partial.
  4. Click the external login button – you will be redirected to the MojoAuth hosted page.
  5. Complete authentication and you will return as a linked Umbraco member.

Useful Resources

Notes

  • Keep your ClientSecret out of source control for real projects. It is included here only for demonstration with placeholder values.
  • Ensure HTTPS is used in production for all redirect URLs.
  • You can extend the auto-linking logic in OpenIdConnectMemberExternalLoginProviderOptions.cs if you need to map more profile fields returned by MojoAuth's userinfo endpoint.

MojoAuth example

About

An example to show how Umbraco and MojoAuth OpenIdConnect work together

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published