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>
<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