# Authentication In order to interact with the external service, most of the time we need to authenticate the user. During the authentication process, account credentials are obtained from the user, validated and stored securely in our systems. You have full control over all this steps. ## Basic Basic authentication is the simplest option. It only requires your user to provide an `username` and a `password`. When used, we will automatically inject a Basic `Authorization` header for every request, which will contain the username and password fields encoded in base64 format. ```javascript const basicAuth = { type: "basic", test: (sdk, bundle) => { // do the necessary api calls to validate your credentials // you can also access the username and password using const {username, password} = bundle.authData; }, connectionLabel: (sdk, bundle) => `Auth ${bundle.inputData.user}`, }; const App = { authentication: basicAuthentication, }; ``` ## Custom This is the most flexible option. ```javascript const customAuth = { type: "custom", test: (sdk, bundle) => { // do the necessary api calls to validate your credentials // you can also access the username and password using const {username, password} = bundle.authData; }, fields: [{ key: "api_key", label: "Api Key" } ], connectionLabel: "Custom auth label here" } const App = { authentication: customAuth, } ``` For more information about what each field does, please see [Authentication schema](/docs/chatlayer/app-schema/authentication-schema)