ApiKey 401 challenge on Nuxt Templates

When using the Nuxt .netcore templates and then adding a ApiKeyAuthProvider to the AuthFeature it causes the browser to display a Browser prompt to ask for username and password when the application loads the login page.


This is the config that I’m using for AuthFeature

new AuthFeature(() => new CustomUserSession(),
            new IAuthProvider[]
                new ApiKeyAuthProvider(AppSettings)
                    SessionCacheDuration = TimeSpan.FromMinutes(10),
                    InitSchema = true,
                new CredentialsAuthProvider(AppSettings), /* Sign In with Username / Password credentials */
                new GoogleAuthProvider(
                new JwtAuthProvider(AppSettings) {AuthKeyBase64 = AppSettings.GetString("AuthKeyBase64")},

Is there a configuration to remove this browser prompt?

The failed challenge response uses the first AuthProvider registered, try moving the ApiKeyAuthProvider so it’s not the first registered.

Magic! that worked, thanks :slight_smile:

1 Like