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

V6 Next.js Amplify: Ability to pass in /login or /signup for opening hosted ui #12282

Open
2 tasks
Meags27 opened this issue Oct 12, 2023 · 13 comments
Open
2 tasks
Assignees
Labels
Auth Related to Auth components/category feature-request Request a new feature VP Version parity issues between v5 and v6

Comments

@Meags27
Copy link

Meags27 commented Oct 12, 2023

Is this related to a new or existing framework?

Next.js

Is this related to a new or existing API?

Authentication

Is this related to another service?

No response

Describe the feature you'd like to request

With the new v6 Amplify for Next.js, they removed the launchUri option which I used to be able to customize the urlOpener in order to change the hosted UI URL from '/oauth2/authorize?' to either '/login?' or '/signup?' so a user could click a button and get directed to either sign up or signin.

Instead, now it calls oauthSignIn and this:

const URL = https://${oauthConfig.domain}/oauth2/authorize?${queryString};
window.open(URL, SELF);

So I can't change the string "/oauth2/authorize?" easily without changing the Amplify source code.

Thanks!

Describe the solution you'd like

Can a parameter be passed in so we can customize the url as needed?

Describe alternatives you've considered

N/A

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@Meags27 Meags27 added the pending-triage Issue is pending triage label Oct 12, 2023
@chrisbonifacio chrisbonifacio added feature-request Request a new feature V6 V6 of Amplify JS Auth Related to Auth components/category labels Oct 13, 2023
@nadetastic nadetastic self-assigned this Oct 13, 2023
@nadetastic
Copy link
Contributor

Related to #11336

@abdallahshaban557
Copy link
Contributor

Hi @Meags27 - we are trying to understand how this feature is impacting your applications and users. Would you consider this a blocker to you using v6 of the Amplify JS library?

@Meags27
Copy link
Author

Meags27 commented Oct 16, 2023

@abdallahshaban557 It's not a deal breaker to using v6, but I would vastly prefer to be able to have the option to run the site the way we did before where we have the navigation bar as "Login" and "Signup" as two different buttons to select and to go to the right page.

@abdallahshaban557
Copy link
Contributor

Got it - thank you for clarifying. Would you be open to using the Amplify Authenticator connected UI component instead of hosted UI? We are planning on releasing major updates to help you fully control the UI of the default experience as well.

@Meags27
Copy link
Author

Meags27 commented Oct 17, 2023

@abdallahshaban557 I can't use the Amplify Authenticator as it doesn't support custom scopes and we wanted the option to be able to whitelist users to certain API calls in API Gateway. This issue here: #3732

We would potentially move to using it if custom scopes were added like the others mentioned in that issue thread.

@abdallahshaban557
Copy link
Contributor

abdallahshaban557 commented Oct 18, 2023

Ah - got it @Meags27 - that makes sense. We are working closely with the Cognito team to resolve this issue on their end, but your reason for needing to use the HostedUI is understandable now. We have added the feature to enable this customization of the URL that opens up for HostedUI to our backlog.

@cwomack cwomack removed the investigating This issue is being investigated label Nov 10, 2023
@cwomack cwomack removed the V6 V6 of Amplify JS label Nov 21, 2023
@Meags27
Copy link
Author

Meags27 commented Jan 13, 2024

I'm wanting to launch for production soon, do you have any suggestions for how I could make a workaround for this?

A user needs to click sign up to agree to TOS and privacy policy before being navigated to Hosted UI, so it's weird when they click sign up but end up being directed to the /login route of the hosted UI.

Edit: This is seriously preventing us from moving to production.

@subliminality
Copy link

Hi @Meags27 - we are trying to understand how this feature is impacting your applications and users. Would you consider this a blocker to you using v6 of the Amplify JS library?

This issue is definitely preventing me from finishing the migration to V6 for one of our projects.

@israx
Copy link
Contributor

israx commented Jan 19, 2024

@subliminality could you clarify how are you using v5 to open the sign-up view from Hosted UI ?

@subliminality
Copy link

subliminality commented Jan 19, 2024

Yes in v5 i overrode the urlOpener on oauth when configuring Amplify

oauth: {
  domain,
  scope,
  redirectSignIn,
  redirectSignOut,
  responseType: 'code',
  urlOpener
}
const urlOpener = async (url) => {
  const redirect = localStorage.getItem(LOGIN_REDIRECT) // login, signup, forgotPassword
  const signupUrl = url.replace(
    /\/oauth2\/authorize\?/,
    `/${redirect ? redirect : 'login'}?`
  )
  return launchUri(url)
}
const launchUri = (url) => {
  const windowProxy = window.open(url, SELF)
  if (windowProxy) {
    return Promise.resolve(windowProxy)
  } else {
    return Promise.reject()
  }
}

@israx
Copy link
Contributor

israx commented Jan 19, 2024

@subliminality Thank you for clarifying the usage. v6 doesn't allow to modify the urlOpener. Ideally we would support this use case from the signInWithRedirect API itself. We will follow up with any updates on this feature request.

@mn-prp
Copy link

mn-prp commented Feb 15, 2024

This upgrade broke our app until we rolled back the changes. We also override the urlOpener in v5 to go straight to sign up page on hosted ui. Like others, the hosted ui is a hard requirement for our use case. I am strongly considering just giving up on Amplify for our company and rolling our own solution, which we've already had to do on mobile, but this change is making web seem necessary too.

@nadetastic nadetastic added feature-parity VP Version parity issues between v5 and v6 and removed feature-parity labels Feb 15, 2024
@trickstival
Copy link

overriding urlOpener is a big feature for hybrid apps that want to use an in-app browser.
I can't upgrade to amplify v6 because of that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auth Related to Auth components/category feature-request Request a new feature VP Version parity issues between v5 and v6
Projects
None yet
Development

No branches or pull requests

9 participants