.. meta:: :robots: noindex, nosnippet .. _appconfig-auth: ================================================== User & Authentication Provider Configuration Files ================================================== .. meta:: :description: Enable and configure authentication providers in your Atlas App Services App. .. facet:: :name: genre :values: reference .. contents:: On this page :local: :backlinks: none :depth: 2 :class: singlecol .. code-block:: none app/ └── auth/ ├── providers.json └── custom_user_data.json .. _config-auth-providers: Authentication Providers ------------------------ Configuration ~~~~~~~~~~~~~ You can enable and configure :ref:`authentication providers ` in ``/auth/providers.json``. Each field of the configuration is the name of a provider type and contains a configuration object for that provider. Authentication provider configurations share a common structure but each provider type uses a unique set of configuration fields. .. tip:: You can find detailed information on a specific provider's configuration on that provider's reference page. For a list of all provider reference pages, see :ref:`Authentication Providers `. .. code-block:: javascript :caption: /auth/providers.json { "": { "name": "", "type": "", "disabled": , "config": { "": "" }, "secret_config": { "": "" }, "metadata_fields": [ { "required": , "name": "Field Name" }, ... ], "redirect_uris": ["", ...] }, ... } .. list-table:: :header-rows: 1 :widths: 10 30 * - Field - Description * - | ``name`` | ``string`` - The name of the authentication provider. This will always be the same as the provider's ``type``. * - | ``type`` | ``string`` - The authentication provider type. Valid options: - ``"anon-user"`` for :ref:`Anonymous ` authentication. - ``"local-userpass"`` for :ref:`Email/Password ` authentication. - ``"api-key"`` for :ref:`API Key ` authentication. - ``"custom-token"`` for :ref:`Custom JWT ` authentication. - ``"custom-function"`` for :ref:`Custom Function ` authentication. - ``"oauth2-google"`` for :ref:`Google ` authentication. - ``"oauth2-facebook"`` for :ref:`Facebook ` authentication. - ``"oauth2-apple"`` for :ref:`Apple ID ` authentication. * - | ``disabled`` | Boolean - If ``true``, this authentication provider is not enabled for your application. Users cannot log in using credentials for a disabled provider. * - | ``config`` | Document - A document that contains configuration values that are specific to the authentication provider. The following provider configurations include ``config``: - :ref:`Email/Password ` - :ref:`Custom JWT ` - :ref:`Custom Function ` - :ref:`Google ` - :ref:`Facebook ` - :ref:`Apple ID ` * - | ``secret_config`` | Document - A document where each field name is a private configuration field for the provider and the value of each field is the name of a :ref:`Secret ` that stores the configuration value. The following provider configurations include ``redirect_uris``: - :ref:`Custom JWT ` - :ref:`Google ` - :ref:`Facebook ` - :ref:`Apple ID ` * - | ``metadata_fields`` | Array - An array of documents where each document defines a metadata field that describes the user. The existence of this field and the exact format of each metadata field document depends on the provider type. The following provider configurations include ``metadata_fields``: - :ref:`Custom JWT ` - :ref:`Google ` - :ref:`Facebook ` * - | ``redirect_uris`` | Array - A list of URLs that Atlas App Services may redirect user back to after they complete an OAuth authorization. The following provider configurations include ``redirect_uris``: - :ref:`Google ` - :ref:`Facebook ` - :ref:`Apple ID ` .. _config-custom-user-data: Custom User Data ---------------- You can configure the :ref:`custom user data ` collection for your app in ``/auth/custom_user_data.json``. .. code-block:: javascript :caption: /auth/custom_user_data.json { "enabled": , "mongo_service_name": "", "database_name": "", "collection_name": "", "user_id_field": "", "on_user_creation_function_name": "" } .. list-table:: :header-rows: 1 :widths: 10 30 * - Field Name - Description * - | ``enabled`` | Boolean - If ``true``, App Services associates each user with a document in the specified collection that contains their custom data. * - | ``mongo_service_name`` | ``string`` - The name of the :ref:`data source ` that contains the custom user data collection. * - | ``database_name`` | ``string`` - The name of the database that contains the custom user data collection. * - | ``collection_name`` | ``string`` - The name of the collection that contains the custom user data. * - | ``user_id_field`` | ``string`` - The name of the field in custom user data documents that contains the user ID of the application user the document describes. * - | ``on_user_creation_function_name`` | ``string?`` - The name of the :ref:`user creation function `.