Microsoft Teams integration with Virtual Agent Authentication Fails: Oauth authentication failed for access tokenIssue Virtual Agent is installed with MS Teams there is an installed team, there is one team installed, go to MS Teams and login to the SN app, never see the option to "Link to ServiceNow". Steps to Reproduce: Start the MS teams chat application, but never get the option to "Link to ServiceNow" Followed the setup docs: https://docs.servicenow.com/csh?topicname=Implement-virtual-agent.html&version=latest https://docs.servicenow.com/csh?topicname=install-now-actions.html&version=latest https://docs.servicenow.com/csh?topicname=install-va-integrations.html&version=latest The following error is seen in the logs: 2019-09-19 07:35:04 (139) http-21 SYSTEM User agent with HTTP/1.1 and no encoding: Microsoft-SkypeBotApi (Microsoft-BotFramework/3.0) 2019-09-19 07:35:04 (139) http-21 SYSTEM New transaction 10C48368DBC80C10CA3018DF4B9619D2 #310827 /api/now/v1/proxy/cs/adapter/va/teams/activity 2019-09-19 07:35:04 (141) Default-thread-2 SYSTEM txid=54c48368dbc8 User agent with HTTP/1.1 and no encoding: Microsoft-SkypeBotApi (Microsoft-BotFramework/3.0) 2019-09-19 07:35:04 (152) Default-thread-2 SYSTEM txid=54c48368dbc8 WARNING *** WARNING *** Get for non-existent record: oidc_provider_configuration:, initializing 2019-09-19 07:35:04 (153) Default-thread-2 SYSTEM txid=54c48368dbc8 WARNING *** WARNING *** No record found in oidc_provider_configuration for sysId= 2019-09-19 07:35:04 (153) Default-thread-2 SYSTEM txid=54c48368dbc8 SEVERE *** ERROR *** Cannot find oauth_oidc_entity for issuer https://api.botframework.com with any of the following client_ids: 49471a10-fdbc-4ffb-b0b8-944f3df985d9 2019-09-19 07:35:04 (153) Default-thread-2 SYSTEM txid=54c48368dbc8 WARNING *** WARNING *** Oauth authentication failed for access token eyJhbGciOiJSUzI1NiIsImtpZCI6IktwSVdSVWxnZmlObGQxRFR4WkFoZTRpTm1rQSIsInR5cCI6IkpXVCIsIng1dCI6IktwSVdSVWxnZmlObGQxRFR4WkFoZTRpTm1rQSJ9.eyJzZXJ2aWNldXJsIjoiaHR0cHM6Ly9zbWJhLnRyYWZmaWNtYW5hZ2VyLm5ldC9hbWVyLyIsIm5iZiI6MTU2ODkwMzcwMywiZXhwIjoxNTY4OTA3MzAzLCJpc3MiOiJodHRwczovL2FwaS5ib3RmcmFtZXdvcmsuY29tIiwiYXVkIjoiNDk0NzFhMTAtZmRiYy00ZmZiLWIwYjgtOTQ0ZjNkZjk4NWQ5In0.XfyAH8fZesaFJOwvlHscsc-OGWSOkgt0Sb_5haem1_jO9V-ZfkxKa1Cnxq71_G0Xvx6ynhx8y0wxypT1KyJb744BEPs8QMjTju39EZtzbTmBvv8franHlpopnOsdbIKA9i6CGgxS4L4OgRd_zrlMYBvZlXVVQT-jlIyJZO-pEKdHLlIuPh2hdwJ36a-xGLv5qLu81Rimd-o3lVNo8VbacapDZlb7Elb644sV-OTU88dZVkt5giL1yS4-vH0XaTEdMirwgFxdG9CUHwV2RpQ1se0Mbxjd5VJcr2htn4M6OSZRx1GWHbR153jU2KEfDRj0OlUt6xuwo-PogEExz9LXdA. No user found. 2019-09-19 07:35:04 (153) Default-thread-2 SYSTEM txid=54c48368dbc8 HTTP authorization validated user 'guest' 2019-09-19 07:35:04 (156) Default-thread-2 SYSTEM txid=54c48368dbc8 Bypassing ACL checks for a public page: /api/now/v1/proxy/cs/adapter/va/teams/activity 2019-09-19 07:35:04 (157) Default-thread-2 SYSTEM txid=54c48368dbc8 #310827 /api/now/v1/proxy/cs/adapter/va/teams/activity Parameters ------------------------- api=api 2019-09-19 07:35:04 (158) Default-thread-2 SYSTEM txid=54c48368dbc8 *** Start #310827 /api/now/v1/proxy/cs/adapter/va/teams/activity, user: guest 2019-09-19 07:35:04 (282) Default-thread-2 SYSTEM txid=54c48368dbc8 WARNING *** WARNING *** Get for non-existent record: oidc_provider_configuration:, initializing 2019-09-19 07:35:04 (282) Default-thread-2 SYSTEM txid=54c48368dbc8 WARNING *** WARNING *** No record found in oidc_provider_configuration for sysId= 2019-09-19 07:35:04 (283) Default-thread-2 SYSTEM txid=54c48368dbc8 No valid record found for openID connect provider configuration. 2019-09-19 07:35:04 (283) Default-thread-2 SYSTEM txid=54c48368dbc8 WARNING *** WARNING *** Get for non-existent record: oidc_provider_configuration:, initializing 2019-09-19 07:35:04 (284) Default-thread-2 SYSTEM txid=54c48368dbc8 WARNING *** WARNING *** No record found in oidc_provider_configuration for sysId= 2019-09-19 07:35:04 (284) Default-thread-2 SYSTEM txid=54c48368dbc8 SEVERE *** ERROR *** fail to valifate token. Invalid OIDC config. 2019-09-19 07:35:04 (284) Default-thread-2 SYSTEM txid=54c48368dbc8 WARNING *** WARNING *** [Context] [MsAdapterMgr] invalid token 2019-09-19 07:35:04 (285) Default-thread-2 SYSTEM txid=54c48368dbc8 #310827 [REST API] RESTAPIProcessor : Unauthorized token 2019-09-19 07:35:04 (286) Default-thread-2 SYSTEM txid=54c48368dbc8 *** End #310827 /api/now/v1/proxy/cs/adapter/va/teams/activity, user: guest, total time: 0:00:00.145, processing time: 0:00:00.145, SQL time: 0:00:00.004 (count: 18), source: 10.242.65.84 , type:rest, method:POST, api_name:now/proxy, resource:now/v1/proxy/cs/adapter/va/teams/activity, version:v1, user_id:b8ff4977dbe0e74042a66572ca961907, response_status:403 CauseMissing configurations on the instance.ResolutionThe following was done to eliminate the initial error:(1) Go to the OAuth OIDC Entity "ServiceNow Virtual Agent Teams App" in table oauth_oidc_entity.(2) At the "OAuth OIDC Provider Configuration" select the magnifying glass and select "Microsoft Teams" and save the change(3) Do a restart from Teams After this the log error changed to the following:2019-10-01 05:08:29 (068) http-17 SYSTEM User agent with HTTP/1.1 and no encoding: Microsoft-SkypeBotApi (Microsoft-BotFramework/3.0)2019-10-01 05:08:29 (069) http-17 SYSTEM New transaction 4A465C68DB904850CA3018DF4B961967 #489944 /api/now/v1/proxy/cs/adapter/va/teams/activity2019-10-01 05:08:29 (071) Default-thread-6 SYSTEM txid=8e465c68db90 User agent with HTTP/1.1 and no encoding: Microsoft-SkypeBotApi (Microsoft-BotFramework/3.0)2019-10-01 05:08:29 (870) http-33 WARNING *** WARNING *** Resource does not exist: /scs/snc_node_disable.html2019-10-01 05:08:30 (008) http-44 WARNING *** WARNING *** Resource does not exist: /scs/snc_node_disable.html2019-10-01 05:08:30 (688) Default-thread-6 SYSTEM txid=8e465c68db90 WARNING *** WARNING *** Ignore claim serviceurl, because it's value is a null object or empty string2019-10-01 05:08:30 (688) Default-thread-6 SYSTEM txid=8e465c68db90 SEVERE *** ERROR *** Invalid claim value. name:serviceurl;value:null2019-10-01 05:08:30 (689) Default-thread-6 SYSTEM txid=8e465c68db90 SEVERE *** ERROR *** Claims are not valid for JWT token from incoming request.2019-10-01 05:08:30 (689) Default-thread-6 SYSTEM txid=8e465c68db90 WARNING *** WARNING *** Oauth authentication failed for access token eyJhbGciOiJSUzI1NiIsImtpZCI6IktwSVdSVWxnZmlObGQxRFR4WkFoZTRpTm1rQSIsInR5cCI6IkpXVCIsIng1dCI6IktwSVdSVWxnZmlObGQxRFR4WkFoZTRpTm1rQSJ9.eyJzZXJ2aWNldXJsIjoiaHR0cHM6Ly9zbWJhLnRyYWZmaWNtYW5hZ2VyLm5ldC9hbWVyLyIsIm5iZiI6MTU2OTkzMTcwOCwiZXhwIjoxNTY5OTM1MzA4LCJpc3MiOiJodHRwczovL2FwaS5ib3RmcmFtZXdvcmsuY29tIiwiYXVkIjoiNDk0NzFhMTAtZmRiYy00ZmZiLWIwYjgtOTQ0ZjNkZjk4NWQ5In0.mEDKnUuRrqo3vZeWGhwG5Pkm1-Ef3wWc4Emf9ScwacFGo8ThJgqw_PvPOKUwa5tfwMAJq_MUhkE9VjtF9u4Zl9aCS86nwKKhVuzApnhiR5gM-DndSOIrhyY-9DnuXEqngLxYvDIG2CQl4VRvgyDAGxs-U3JV6MQ48YjSm6hqOLrEefMUwt7ATLJniTWwhmybfIajQmXANe6d_Soi8HW5sBf9RjxRhmQ4-w785FcHFyZdTdO5EeBE5RuNIQBzrJ6JSljnyQWQl11456LnIYXfLZby38InwwhhPBP8lNM18D_caeTj7rRzBr8QNBZw00_vukxhU4Zp0S5yg4f4L5QhXg. No user found.2019-10-01 05:08:30 (689) Default-thread-6 SYSTEM txid=8e465c68db90 HTTP authorization validated user 'guest'2019-10-01 05:08:30 (692) Default-thread-6 SYSTEM txid=8e465c68db90 Bypassing ACL checks for a public page: /api/now/v1/proxy/cs/adapter/va/teams/activity2019-10-01 05:08:30 (694) Default-thread-6 SYSTEM txid=8e465c68db90 #489944 /api/now/v1/proxy/cs/adapter/va/teams/activity Parameters -------------------------api=api2019-10-01 05:08:30 (694) Default-thread-6 SYSTEM txid=8e465c68db90 *** Start #489944 /api/now/v1/proxy/cs/adapter/va/teams/activity, user: guest2019-10-01 05:08:30 (701) Default-thread-6 SYSTEM txid=8e465c68db90 *** End #489944 /api/now/v1/proxy/cs/adapter/va/teams/activity, user: guest, total time: 0:00:01.632, processing time: 0:00:01.632, SQL time: 0:00:00.009 (count: 12), source: 10.242.65.20 , type:rest, method:POST, api_name:now/proxy, resource:now/v1/proxy/cs/adapter/va/teams/activity, version:v1, user_id:b8ff4977dbe0e74042a66572ca961907, response_status:200We found that the configuration is missing for the microsoft teams application in the table sys_cs_vendor_client_adapter_configuration. To resolve this second error the following instruction was given:(1) To recover, we can find the configuration page record in sys_cs_adapter_configuration_page_teams (name == <some_name>).Edit the name "<some_name>" to "<some_name> " (plus a space to force an update, you can remove the space later, but it doesn't matter)There will be a business rule triggered to generate a new sys_cs_vendor_client_adapter_configuration record.Performing the above recovers the configuration record. (2) Do a restart from Teams