Reputation: 5206
With the npm package @aws-amplify/auth
using react (import Auth from '@aws-amplify/auth'
), there are some exported functions such as Auth.signUp({...})
and Auth.federatedSignIn()
. The federatedSignIn
sends users to the federated sign in endpoint with path /login
. I would like to send them to /signup
path but there is no such federatedSignUp()
function, anyone know a solution to send them to the /signup
federated endpoint?
Upvotes: 0
Views: 595
Reputation: 5206
Using @jellycsc 's solution and expanding upon it (because I got unauthorized) here is what worked (I recommend anyone else go to their sign up url and copy it in manually and systematically replace values).
const baseUrl = `https://${aws.idpDomain}/signup`
const search = `?response_type=token&client_id=${aws.userPoolWebClientId}&redirect_uri=${encodeURIComponent(
aws.redirectSignIn
)}&identity_provider=COGNITO&scope=email%20openid%20profile`
window.location.replace(baseUrl + search)
Upvotes: 0
Reputation: 12359
My solution is to just redirect user to the following URL:
https://${COGNITO_OAUTH_DOMAIN}/signup?response_type=code&client_id=${CLIENT_ID}&redirect_uri=${encodeURIComponent(COGNITO_OAUTH_REDIRECT_SIGN_IN_URL)}
Upvotes: 2