{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":40870,"path":"platform-security/connections-and-credentials/configure-a-custom-authentication-algorithm.md","title":"Configure a custom authentication algorithm","bundle":null,"doc_type":null,"release":"australia","body":"\n# Configure a custom authentication algorithm\n\nGenerate the custom data needed to authenticate to a web service by running script.\n\n## Before you begin\n\n-   JavaScript knowledge\n-   REST knowledge\n-   Target web service API knowledge\n-   Connection, credential, and alias knowledge\n-   Role required: Developer\n\n## About this task\n\nUse a connection and credential alias and custom authentication based algorithm for authentication.\n\n## Procedure\n\n1.  Navigate to **All** &gt; **Credentials &amp; Connections** &gt; **Authentication Algorithms**, and click **New**.\n\n2.  On the form, fill in the fields.\n\n    The database selection in the **Format** field determines which fields are available.\n\n<table id=\"table_dls_tpv_sx\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nName\n\n</td><td>\n\nUnique name of this algorithm.\n\n</td></tr><tr><td>\n\nAlgorithm\n\n</td><td>\n\nOutbound request type. Select **Custom Authentication**.\n\n</td></tr><tr><td>\n\nDescription\n\n</td><td>\n\nDescription of what your algorithm does.\n\n</td></tr><tr><td>\n\nApplication\n\n</td><td>\n\nScope that your application runs in.\n\n</td></tr><tr><td>\n\nInstance Authentication Script\n\n</td><td>\n\nScript that you select from the Script Includes table. The scripts available are as follows:-   RequestAuthAWSV4Signer\n-   RequestAuthInternal\n-   RequestAuthSampleCustomSigner\n-   RequestAuthTwitterSigner\n **Note:**\n\n-   To know more about the script click the information icon next to the field. The details of the script such as Name, API Name, Application, Accessible from, Script, and so on is displayed.\n-   In case of custom authentication with Twitter, you can choose **RequestAuthTwitterSigner**, since it uses an OAuth 1.0a method of authentication. This requires informations such as **API key and secret** and **Access token and secret** that can be used to create signatures to pass in an authorization header. For more information, see [Authentication in Twitter](https://developer.twitter.com/en/docs/authentication/oauth-1-0a).\n\n\n</td></tr><tr><td>\n\nMID Authentication Script\n\n</td><td>\n\nScript that you select from the MID Server Script Includes \\[Discovery view\\] table. The scripts available are as follows:-   RequestAuthAWSV4Signer\n-   RequestAuthInternal\n-   RequestAuthSampleCustomSigner\n-   RequestAuthTwitterSigner\n\n\n</td></tr></tbody>\n</table>    \\[Omitted image \"custom-authentication-algorithm.png\"\\] Alt text: Twitter authentication algorithm\n\n    Based on the selected scripts and authentication algorithm, the configured credentials is sent as outbound request from ServiceNow to the provider.\n\n3.  Click **Update**.\n\n4.  Navigate to **All** &gt; **Connections &amp; Credentials** &gt; **Credentials**.\n\n5.  Click **New**.\n\n6.  Create Twitter Credentials with Authentication Algorithm.\n\n    In this case **TwitterAuthAlgo**.\n\n7.  Specify the fields:\n\n    -   Name\n    -   Active\n    -   Access token\n    -   Access token secret\n    -   Consumer key\n    -   Consumer secret\n    -   Credential alias\n    -   Authentication Algorithm\n    \\[Omitted image \"twitter-algorithm.png\"\\] Alt text: Twitter Credentials\n\n8.  Click **Update**.\n\n\n## REST step with Twitter\n\nIn case of Twitter, you must ensure the following spokes or credentials are available:\n\n-   Access token\n-   Access token secret\n-   Consumer key\n-   Consumer secret\n-   Authentication Algorithm\n\nAction: TwitterAuthAlgo.\n\nInput REST step with Twitter as follows:\n\n-   **Credentials Alias**: The alias that is created for Twitter.\n-   **Base URL**: Base URL details from Twitter.\n-   **HTTPS Method**: In this case it is POST method. Posting a tweet.\n-   **Query Parameters**: **Action** as **tweet**.\n\n\\[Omitted image \"twitter-post.png\"\\] Alt text: Post Tweet\n\nYou can test the action. The tweet is posted on the Twitter page.\n\n"}}