Skip to content

Commit

Permalink
hotfixes
Browse files Browse the repository at this point in the history
hotfix to handle oauth2 users
  • Loading branch information
ahabeb committed Jul 28, 2022
1 parent d58dc47 commit a1e8a52
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/widget/formatSSO.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@ export const formatSSO = (url, ssoUserString) => {
}

return url.replace('{{SSO}}', '');
};
};

export const formatOAuth = (url, accessToken) => {
if (accessToken) {
return url.replace('{{SSO}}', encodeURIComponent(accessToken));
}

return url.replace('{{SSO}}', '');
};
13 changes: 11 additions & 2 deletions src/widget/widget.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const buildfire = require('buildfire');
const { formatSSO } = require('./formatSSO');
const { formatSSO, formatOAuth } = require('./formatSSO');

const viewOptions = {
POPUP: 'In app popup',
Expand Down Expand Up @@ -55,6 +55,15 @@ const render = (content) => {
content.url = formatSSO(content.url, JSON.stringify(result.SSO));
handleWindow(openWindow, displayIniFrame, displaySuccessMessage);
}
else{
if (result && result.oauthProfile && result.oauthProfile.accessToken) {
content.url = formatOAuth(content.url, result.oauthProfile.accessToken);
handleWindow(openWindow, displayIniFrame, displaySuccessMessage);
}
else{
handleWindow(openWindow, displayIniFrame, displaySuccessMessage);
}
}
});
} else { //this is all other URLs, i.e. no SSO.
handleWindow(openWindow, displayIniFrame, displaySuccessMessage);
Expand Down Expand Up @@ -101,7 +110,7 @@ const renderiFrame = (props) =>{
let container = props.isIOS ? scrollable : window.document.body;

container.appendChild((() => {

if (flags.isWeb) {
let modal = (document.querySelectorAll('div[id^="confirm"]') || [])[0];
if (modal) {
Expand Down

0 comments on commit a1e8a52

Please sign in to comment.