Auth0 Home Blog Docs

OpenID Middleware with Lock?

lock
login
middleware

#1

Is it possible to use both the OpenID middleware and shown in the ASP.NET (OWIN) quickstart tutorial, but instead of using the Universal Login, use the Lock v11? I haven’t been able to get it to work so far, so any help is greatly appreciated.

We’re looking to integrate the OpenID middleware approach in a .NET MVC application but would love to be able to leverage the Lock component to generate the login form in custom ways throughout the application. I would like to avoid having to make a custom login form, if possible. I can successfully get the middleware to redirect the user to a custom page (code blow) with the Lock form visible on the page, but once they authenticate successfully, the page redirects and errors out with the message “Callback URL mismatch”.

Here is the Lock config we’re using:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title></title>
    <script src="https://cdn.auth0.com/js/lock/11.11.0/lock.min.js"></script>
</head>
<body>
    <div id="login-container"></div>
    <script>
        // Build Auth0 login form options
        // More options here: https://auth0.com/docs/libraries/lock/v11/configuration
        var options = {
            container: 'login-container', 
            allowedConnections: ['Username-Password-Authentication'],
            allowSignUp: false,
            forgotPasswordLink: '/reset-password', 
            language: 'en', 
        };

        // Create Auth0 lock object
        var lock = new Auth0Lock(
            'xxx',
            'yyy',
            options
        );

        // Show form
        lock.show();
    </script>
</body>
</html>