Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/esr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ export async function createIdentityRequest(
if (typeof window !== 'undefined') {
const returnUrl = generateReturnUrl()
sameDeviceRequest.setInfoKey('same_device', true)
sameDeviceRequest.setInfoKey('return_path', returnUrl)
if (returnUrl !== undefined) {
sameDeviceRequest.setInfoKey('return_path', returnUrl)
}
}

// Return the request and the callback data
Expand Down
7 changes: 6 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ export function uuid(): string {
}

/** Generate a return url that Anchor will redirect back to w/o reload. */
export function generateReturnUrl() {
export function generateReturnUrl(): string | undefined {
// Return undefined for iOS React Native apps to prevent redirect to Safari
if (isAppleHandheld() && isReactNativeApp()) {
return undefined
}

if (isChromeiOS()) {
// google chrome on iOS will always open new tab so we just ask it to open again as a workaround
return 'googlechrome://'
Expand Down