-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use POST for SAML login #52658
base: main
Are you sure you want to change the base?
Use POST for SAML login #52658
Conversation
Appears to be failing on an unrelated tyepscript check error - but should be ready for review
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly have some questions / clarifications :)
} | ||
return response.json() as Promise<Response>; | ||
}) | ||
.then((response) => response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this second .then()
? Can we return the json in the previous .then()
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, at least from my testing we need both - I also followed the convention from here
return fetch(CONFIG.EXPENSIFY.SAML_URL, { | ||
method: CONST.NETWORK.METHOD.POST, | ||
body, | ||
credentials: 'omit', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious - why are we setting credentials:omit
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the convention used here - I can test without it but figured it was safest to go with logic we already knew worked.
} | ||
|
||
const body = new FormData(); | ||
body.append('email', credentials?.login ?? ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if email is set as an empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think rn the iDP page fails to load so they get stuck on the loading screen, i'll update the logic to return early if there's no login to pass.
Navigation.navigate(ROUTES.HOME); | ||
|
||
Navigation.isNavigationReady().then(() => { | ||
// We must call goBack() to remove the /transition route from history |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious - where is this transition route set? Is it only from OldDot -> NewDot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah OldDot -> NewDot - here
Co-authored-by: Maria D'Costa <[email protected]>
…ikki-saml-use-post
Off hold now that the corresponding Web-E PR is on prod! |
Explanation of Change
Updates the SAML login flow to use a POST request instead of opening a user-modifiable URL
Dependant on https://github.com/Expensify/Web-Expensify/pull/44462
Fixed Issues
$ Tied to https://github.com/Expensify/Expensify/issues/424196
PROPOSAL: N/A
Tests
*(Internal) *
Success Flow
Use Single Sign On
optionError Flow
try{
here:throw new ExpException('An error occurred while loggin in, please try again.', 403);
Use Single Sign On
optionAn error occurred while loggin in, please try again.
Notes for dev testing:
For the newDot redirect to work locally you may need to hardcode the following value to
true
.For mobile testing, you will need to change the url in OneLogin's Expensidev application to your ngrok url instead of
https:://www.expensify.com.dev/
so that it loads correctly on the simulators. You can do that by loggin into OneLogin (using carlos@ or dbondy@ creds in 1Pass), going to Administration > Left Hamburger Menu > Applications > Applications > Expensidev Connection > Configuration and updating the urls inACS (Consumer) URL Validator
andACS (Consumer) URL
Lastly, for Android mWeb, if you use
127.0.0.1:8082/
for your newDot URL, you'll need to update the usage ofURL_TO_NEWDOT
here to use that URL instead.(External)
Use Single Sign On
optionOffline tests
N/A SAML is not supported offline
QA Steps
Log into New Expensify with the email [email protected]
Choose
Use Single Sign On
optionConfirm you briefly see an interstitial page about launching your SSO provider's login portal
Enter the SSO credentials for [email protected] (in 1password under
QA OneLogin
)Confirm you're redirected back to New Expensify and are logged into your account
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Error:
Screen.Recording.2024-11-28.at.18.19.42.mov
Success:
android.success.mov
Android: mWeb Chrome
Error:
mweb.android.failure.mov
Success:
android.mweb.success.mov
iOS: Native
Error:
ios.error.mp4
Success:
ios.success.mp4
iOS: mWeb Safari
Error:
ios.mweb.error.mp4
Success:
ios.mweb.success.mp4
MacOS: Chrome / Safari
Error:
web.error.mov
Success:
web.success.mov
MacOS: Desktop
Error:
desktop.error.mov
Success:
desktop.success.mov