Log-in with Google

Cosmos incorporates the Microsoft Identity Framework to facilitate user log-ins via Google. Your website can be set up to support either or both, alongside email log-in. If desired, email log-in can be disabled. To activate Google log-in, you will require a "Client Id" and a "Client Secret," which must be entered into the Cosmos environment variable settings. For information about how to obtain each setting, please see Create the Google OAuth 2.0 Client ID and secret.

Google Environment Variables

After you have obtained a client ID and secret from Google, create the following environment variables.  This works for both the “Publisher” and “Editor” web applications.

Place the “client ID” in this environment variable: “GoogleOAuth__ClientId”.

The “secret” goes into this environment variable: “GoogleOAuth_ClientSecret”.

Important: Whenever making changes to environment variables, stop the web application and wait about 20 seconds, then restart.  This will ensure the “containers” that Cosmos runs in fully stop before restarting.

Publisher specific settings

Your website “publisher” is normally setup to allow anonymous access--in other words--it does not require users to log in. To disable anonymous access for the Publisher, and require login, set the following environment variable with both the publisher and editor to “true”:

CosmosRequiresAuthentication = true

Disable Login with Email

Sometimes it is desirable to disable the ability for users to create accounts and login with their email. Disabling means users must either create accounts with Microsoft or Google instead.

To disable, make the following environment variable change:

Set "AllowLocalAccounts" to “false”.

Once this environment variable is set, restart your Cosmos website.