Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 481b67c

Browse files
authored
Merge pull request #62 from BuildFire/support-oauth2
hotfixes
2 parents d58dc47 + a1e8a52 commit 481b67c

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/widget/formatSSO.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,12 @@ export const formatSSO = (url, ssoUserString) => {
88
}
99

1010
return url.replace('{{SSO}}', '');
11-
};
11+
};
12+
13+
export const formatOAuth = (url, accessToken) => {
14+
if (accessToken) {
15+
return url.replace('{{SSO}}', encodeURIComponent(accessToken));
16+
}
17+
18+
return url.replace('{{SSO}}', '');
19+
};

src/widget/widget.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const buildfire = require('buildfire');
2-
const { formatSSO } = require('./formatSSO');
2+
const { formatSSO, formatOAuth } = require('./formatSSO');
33

44
const viewOptions = {
55
POPUP: 'In app popup',
@@ -55,6 +55,15 @@ const render = (content) => {
5555
content.url = formatSSO(content.url, JSON.stringify(result.SSO));
5656
handleWindow(openWindow, displayIniFrame, displaySuccessMessage);
5757
}
58+
else{
59+
if (result && result.oauthProfile && result.oauthProfile.accessToken) {
60+
content.url = formatOAuth(content.url, result.oauthProfile.accessToken);
61+
handleWindow(openWindow, displayIniFrame, displaySuccessMessage);
62+
}
63+
else{
64+
handleWindow(openWindow, displayIniFrame, displaySuccessMessage);
65+
}
66+
}
5867
});
5968
} else { //this is all other URLs, i.e. no SSO.
6069
handleWindow(openWindow, displayIniFrame, displaySuccessMessage);
@@ -101,7 +110,7 @@ const renderiFrame = (props) =>{
101110
let container = props.isIOS ? scrollable : window.document.body;
102111

103112
container.appendChild((() => {
104-
113+
105114
if (flags.isWeb) {
106115
let modal = (document.querySelectorAll('div[id^="confirm"]') || [])[0];
107116
if (modal) {

0 commit comments

Comments
 (0)