Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handoff.ServiceNow raise error ServiceNowHandoff->No ServiceNow authentication token available #526

Open
anandshenoy opened this issue Jan 9, 2023 · 4 comments

Comments

@anandshenoy
Copy link

Hi Team,

I am working on integration the Servicenow Live agent chat with Bot framework. I used this library: Bot.Builder.Community.Components.Handoff.ServiceNow.

After following the steps provided with Oauth authentication, I am getting the error in handoff section, where I see the error "No ServiceNow Authentication token available".

Can anyone let me know if I am missing any step?

@ztaylorMNP
Copy link

I am having a similar issue. I am using the Handoff.ServiceNow component in a Bot Framework Composer solution published as a Power Virtual Agent skill. I have followed the instructions to configure both ServiceNow and my Bot Channel Oauth settings. Running the "Test connection" is successful and I receive a token. Testing the ServiceNow endpoints in Postman is also successful. However, when testing the bot, I see the "No ServiceNow authentication token available for this user" message.

Application Insights reports there is a 404 error occurring at:
https://api.botframework.com/api/usertoken/GetToken?userId=[myuserid]&connectionName=CustomHandoffBot_OAuth

The error is occuring on line 37 of the ServiceNowHandoffMiddleware class:

//
// Bot.Builder.Community.Components.Handoff.ServiceNow.ServiceNowHandoffMiddleware.RouteActivityToExistingHandoff(ITurnContext turnContext, HandoffRecord handoffRecord)
//
 var tokenResponse = await userTokenClient.GetUserTokenAsync(turnContext.Activity.From.Id, _creds.ServiceNowAuthConnectionName, null, null, default(CancellationToken));

Bot Channel Oauth config is here:
oauth-settings-redacted

I thought the issue might be in my App Registration Redirect URLs, so I tried adding https://token.botframework.com/.auth/web/redirect to the list with no success.

Any assistance/direction on this would be greatly appreciated.

@surajmusmade
Copy link

surajmusmade commented Aug 24, 2023

Hi Team,
I am facing similar issue. Any update on the issue?

Thanks in advance!

@ztaylorMNP
Copy link

Hi,

I was later able to resolve the missing token issue by including an OAuth Login step in my Event Received activity like below:

image

The instructions had not been clear in stating that the OAuth step was required. I had the impression that OAuth only needed to be configured and the Handover component would handle the rest.

The result should be that the bot will present a "login" button in the chat for the user. User clicks the button, is taken to the Service Now login and prompted to "allow" the bot to access their account. The user is then redirected to a token page where they are prompted to copy a string token and paste it into the chat window to complete the sign-in.

NOTE:
There does appear to be a bug in the Bot Framework Composer OAuth component where an "InputDialog is missing a prompt" exception is thrown. https://github.com/microsoft/BotFramework-Composer/issues/9624

@surajmusmade
Copy link

Thank you @ztaylorMNP,
It's working now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants