-
Notifications
You must be signed in to change notification settings - Fork 927
Add the outward-bound part of the Cordova redirect flow to auth@exp #4413
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
Conversation
|
tid?: string; | ||
} & { [key: string]: string | undefined }; | ||
|
||
export function _getRedirectUrl( |
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.
This is moved from platform_browser/popup_redirect
. The only change is that it now has an "additionalParams" parameter
Binary Size ReportAffected SDKs
Test Logs |
@@ -35,6 +35,8 @@ function getTestFiles(argv) { | |||
return ['src/**/*.test.ts', 'test/helpers/**/*.test.ts']; | |||
} else if (argv.integration) { | |||
return ['test/integration/**/*.test.ts']; | |||
} else if (argv.cordova) { | |||
return ['src/platform_cordova/**/*.test.ts']; |
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.
Question: shall we add the other tests too?
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.
Which other tests?
@@ -86,7 +86,7 @@ export interface PopupRedirectResolver extends externs.PopupRedirectResolver { | |||
provider: externs.AuthProvider, | |||
authType: AuthEventType, | |||
eventId?: string | |||
): Promise<never>; | |||
): Promise<unknown>; |
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.
Why this change?
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.
In Cordova environments, the redirect does not necessarily end the activity, so a call to signInWithRedirect()
can actually resolve
packages-exp/auth-exp/src/platform_cordova/popup_redirect/popup_redirect.test.ts
Outdated
Show resolved
Hide resolved
packages-exp/auth-exp/src/platform_cordova/popup_redirect/utils.test.ts
Outdated
Show resolved
Hide resolved
}); | ||
|
||
describe('_performRedirect', () => { | ||
let isBrowsertabAvailable: boolean; |
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.
Consider following setUA
and remove this variable. Each test below explicitly sets isBrowsertabAvailable
anyway.
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.
Only one of these has it set to true, the rest to false
* protocol). | ||
*/ | ||
async function computeSha256(sessionId: string): Promise<string> { | ||
const encoder = new TextEncoder(); |
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 do we do for IE11? https://caniuse.com/textencoder says no support
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 didn't realize Cordova supported IE11 :(
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.
Added a function to fallback to a simple encoding function
This change handles the generation of the redirect URL including lots of platform-specific handling. This change allows
signInWithRedirect()
to successfully redirect to the oauth handler / IdP page. The event is not yet handled on return, however.