Skip to content
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

fix(auth): Allow Web Urls on signInWithRedirect in Mobile Apps #12969

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ export function getRedirectUrl(redirects: string[]): string {
!redirect.startsWith('http://') && !redirect.startsWith('https://')
);
if (!redirect) {
throw invalidRedirectException;
}
if (redirects.length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Looks like a tabbing error with this block

throw invalidRedirectException;
} else {
// fallsback to available redirect URL. Addresses: https://github.com/aws-amplify/amplify-js/issues/12890
return redirects[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always return the first url? What if they want to call a particular url instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how a customer would select that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By re-directing to the right url is understanding please correct me
if and only if I am wrong or not
@elorzafe 😕

}
}
return redirect;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes will still return the mobile url right?
Ex: Giving ["mobile://", "http://"] as input the output is still "mobile://" url
In the issue linked, it seems like they want to hit "http://" first then "mobile://"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, the issue is how a customer would choose which url to choose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will still choose first mobile url because is filtered. Now if you want to force the web url, that seems something that could be address by an API change

Copy link
Contributor

@jimblanc jimblanc Feb 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, with the current API there's no way to actively select which URL gets used. We (along with other platforms) use a heuristic to determine which URL to use.

}