web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Copilot Studio
Unanswered

Connect SSO in PVA

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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.

 

nportillo_0-1633488236733.png

 

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>
<script>
var clientApplication;
(function () {
var msalConfig = {
auth: {
clientId: '5ad6f08d-ab16-45b9-892b-f892e1740c1b',
authority: 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47'
},
cache: {
cacheLocation: 'localStorage',
storeAuthStateInCookie: false
}
};
if (!clientApplication) {
clientApplication = new Msal.UserAgentApplication(msalConfig);
}
} ());
</script>
<body><script>
function getOAuthCardResourceUri(activity) {
if (activity &&
activity.attachments &&
activity.attachments[0] &&
activity.attachments[0].contentType === 'application/vnd.microsoft.card.oauth' &&
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) {
console.log(error);
});
}
else {
return Promise.resolve(null);
}
}
</script>
<iframe src=https://web.powerva.microsoft.com/environments/839eace6-59ab-4243-97ec-a5b8fcc104e4/bots/new_bot_2670e1e442e2406188ce3de9362afb18/webchat frameborder="0" style="width: 100%; height: 100%;">
</body></head></html>

 

Any help is highly appreciated @ximenav

Categories:
I have the same question (0)
  • saadzagh Profile Picture
    32 on at

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

  • nportillo Profile Picture
    Microsoft Employee on at

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

     

  • saadzagh Profile Picture
    32 on at

    Hi,

     

    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 token.botframework.com

    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.


  • nportillo Profile Picture
    Microsoft Employee on at

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

    nportillo_0-1633976733789.png

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 255 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 205 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 101 Moderator

Last 30 days Overall leaderboard