Showing results for 
Search instead for 
Did you mean: 

Connect SSO in PVA

Hello community looking for help.

I am trying to connect SSO in PVA on the Sharepoint website


I followed all the steps described here Configure single sign-on - Power Virtual Agents | Microsoft Docs and while I can see that the bot briefly calls SSO for authentication it looks like that call get override by regular token authentication (asking for a code) and can't find the error.




I added to my SharePoint this code but it doesn't replace the code authentication with SSO. What I am doing wrong? This is the modified code that I added to Sharepoint

<!DOCTYPE html><html><head>
var clientApplication;
(function () {
var msalConfig = {
auth: {
clientId: '5ad6f08d-ab16-45b9-892b-f892e1740c1b',
authority: ''
cache: {
cacheLocation: 'localStorage',
storeAuthStateInCookie: false
if (!clientApplication) {
clientApplication = new Msal.UserAgentApplication(msalConfig);
} ());
function getOAuthCardResourceUri(activity) {
if (activity &&
activity.attachments &&
activity.attachments[0] &&
activity.attachments[0].contentType === 'application/' &&
activity.attachments[0].content.tokenExchangeResource) {
// asking for token exchange with AAD
return activity.attachments[0].content.tokenExchangeResource.uri;

function exchangeTokenAsync(resourceUri) {
let user = clientApplication.getAccount();
if (user) {
let requestObj = {
scopes: [resourceUri]
return clientApplication.acquireTokenSilent(requestObj)
.then(function (tokenResponse) {
return tokenResponse.accessToken;
.catch(function (error) {
else {
return Promise.resolve(null);
<iframe src= frameborder="0" style="width: 100%; height: 100%;">


Any help is highly appreciated @ximenav

Frequent Visitor

The reply url configured in the app registration should be the web page url hosting the bot, and not the


Hi, agree but that is my problem, I can't find a way to update or bypass that canvas 😞




Here is two things to be considered to have SSO working:

The reply URL should be the sharepoint url. If you are receiving the code it is because you are using the

Was your bot created on dev environnement then exported/imported to another environnement? If Yes I have the same problem, my bot works perfectly with SSO on Dev env, but not on test Env.


What do you mean by "cannot find a way to update"? as I said the URL could be modified on Azure > App registration.

Hi thanks for the follow up, I do see this in my App registration view. It is currently pointing to my desired sharePoint


Is this the right place or there is another place where I need to make sure?

Helpful resources

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Center-of-Excellence-Starter-Kit-cropped 768x460.png

The Total Economic Impact™ of Power Virtual Agents

Read this 2021 commissioned study, conducted by Forrester Consulting.

Users online (2,403)