How to generate bearer token for oAuth 2.0 - Authorization Grant typeDescriptionThe Now Platform supports OAuth 2.0 - Authorization Grant type for public clients to generate an access token. This requires 3 steps. Register the appGenerate Authorization CodeGenerate Bearer Token using Authorization Code. Use Case Use Access Token to access Table API or Scripted Web Service. Register the app Navigate to System oAuth > Application Registry > Create an OAuth API endpoint for external clients NameDefinitionNameName of the registered appClient IDclient id of the registered appClient Secretclient secret of the registered appRedirect URIAuthorization code is returned to this URI. This is usually the endpoint of the registered app. The screenshot has login.do for demo purposesAuthorization Code Life SpanThe lifespan of the authorization code. Extend the lifespan if required. It expires in 60 seconds by default.Access Token Life SpanThe lifespan of the access tokenRefresh Token Life SpanThe lifespan of the refresh token Generate Authorization Code Authorization code requires a user login. Use these steps to generate an authorization code. Access the authorization endpoint. This requires response type, redirect uri, and client id:/oauth_auth.do?response_type=code&redirect_uri=https://<instance-name>.service-now.com/login.do&client_id=40a3df6195c9ef0042a86892403d3f6c** If you get the error 'state missing', please use the following URL and pass the state parameter as well: http://myinstance.service-now.com/oauth_auth.do?grant_type=authorization_code&client_id=<your client id>&response_type=code&state=123 Check this link for more info. The user is redirected to oauth login page: /oauth_login.doEnter valid credentials.User needs to either Allow/Deny the request.Authorization code is returned to redirect uri after clicking Allow. /login.do?code=3ZdugC1R6Tj-HCDB0pLDZRCw4YdHij23TjjZKGlFDfboRIkKFYKcMrXNRcke9uHj1WblkdGwf6J3fctG64Ng9w Generate Bearer Token oauth_token.do supports post ( form url encoded ) to generate an access token. This requires code, redirect uri, client id, client secret, and grant type to generate an access token. Curl:curl -d "grant_type=authorization_code&code=3ZdugC1R6Tj-HCDB0pLDZRCw4YdHij23TjjZKGlFDfboRIkKFYKcMrXNRcke9uHj1WblkdGwf6J3fctG64Ng9w&client_id=40a3df6195c9ef0042a86892403d3f6c&client_secret=V28UreS4)H&redirect_uri=https://<instance-name>.service-now.com/login.do" https://<instance-name>.service-now.com/oauth_token.do Output:{"access_token":"_OmjfKUv1pevKZRZCwtrDzqTSxPgah_DP7ulz8ZZY0Bt_7w-nPwvIhBuFFmJ23wcV9mnm1_37v9FEUqgFA9mkQ","refresh_token":"kCMQS101TU8o6xKB6mUu5Z7V25sFDpOSxcwnhhzhckkfDMihe1uBA255YC9v8jol83kut28zH0MiFLegbkj3Lg","scope":"useraccount","token_type":"Bearer","expires_in":1799} Release or EnvironmentGeneva and newerAdditional InformationRFC: https://tools.ietf.org/html/rfc6749#section-1.3.1OAuth authorization code grant flow