Open AndresCi2 opened 1 day ago
Hi @AndresCi2 thanks for opening this issue. Normally InvalidOriginException
gets thrown when the domain of the url that the end user redirected back from Facebook doesn't match the urls listed in the redirectSignIn
field in your configuration. Could you double check whether redirectSignIn: [${BASE_URL}/auth/signin],
in your configuration has correct value?
Hola@AndresCi2Gracias por abrir este problema. Normalmente,
InvalidOriginException
se produce cuando el dominio de la URL a la que el usuario final se redirigió desde Facebook no coincide con las URL que figuran en elredirectSignIn
campo de tu configuración. ¿Podrías comprobar siredirectSignIn: [${BASE_URL}/auth/signin],
tu configuración tiene el valor correcto?
Hello if the value I am using is the domain of amplify.com that is generating the amplify amplification when it was created.
And do the domains from both match? Could you provide the full url when it redirected back and the actually evaluated value of the redirectSignIn
field?
¿Y coinciden los dominios de ambos? ¿Podrías proporcionar la URL completa cuando se redirigió de vuelta y el valor evaluado realmente del
redirectSignIn
campo?
of course this is my url which I have configured in redirectSignIn “desarrollo.d22q0x5cvvqgsb.amplifyapp.com” but when I try to redirect in browser console I find this error InvalidOriginException: redirect is coming from a different origin. The oauth flow must be started from the same origin.
I tried to initiate a sign-in with Google or Facebook from your website, and I received redirect mismatch error. This indicates you have configuration error on the redirect URLs due mismatch. Please check whether your configuration is correct.
Intenté iniciar sesión con Google o Facebook desde su sitio web y recibí un error de redirección no coincidente. Esto indica que tiene un error de configuración en las URL de redirección debido a una falta de coincidencia. Verifique si su configuración es correcta.
Could you confirm me if the configuration should be checked on the amplify console or my nextjs configuration. Considering if it is my nextjs this is the configuration I am using I don't know what I have wrong.
export const amplifyConfig: ResourcesConfig = {
Auth: {
Cognito: {
userPoolId: env.NEXT_PUBLIC_COGNITO_USERPOOL_ID,
userPoolClientId: env.NEXT_PUBLIC_COGNITO_CLIENT_ID,
signUpVerificationMethod: 'code',
loginWith: {
email: true,
oauth: {
redirectSignIn: [${BASE_URL}/auth/signin
],
redirectSignOut: [${BASE_URL}/auth/signin
],
domain: env.NEXT_PUBLIC_COGNITO_DOMAIN,
responseType: "code",
scopes: ["email", "openid", "profile", "aws.cognito.signin.user.admin", "phone"],
providers: ['Google', 'Facebook'],
},
}
}
}
};
in other file
import { amplifyConfig } from "../aws-exports"; Amplify.configure({...amplifyConfig}, { ssr: true });
As I don't have visibility into your project set up and env vars. You may try to check the following:
${BASE_URL}/auth/signin
in your configurationComo no tengo visibilidad de la configuración de tu proyecto ni de las variables de entorno, puedes intentar comprobar lo siguiente:
- Vaya a la consola de Amazon Cognito -> Integración de aplicaciones -> Clientes y análisis de aplicaciones -> haga clic en el cliente que está usando -> Interfaz de usuario alojada. La URL que aparece en "URL de devolución de llamada permitidas" debe coincidir exactamente con la cadena evaluada
${BASE_URL}/auth/signin
en su configuración.
Hi, I was reviewing the steps you indicated and indeed the url of allowed calls and logout is the same as the one I am using.
Hi @AndresCi2 I attempted debugging with your website again, I saw the urls you provide for redirectSignIn
and redirectSignIn
contain https://www.dev.avatarqr.co/auth/signin
, which doesn't match your testing website URL, this will raise the error as expected.
You would need to ensure the urls you provided match the hosting domain.
Hola@AndresCi2Intenté depurar nuevamente su sitio web, vi las URL que proporciona
redirectSignIn
yredirectSignIn
contienehttps://www.dev.avatarqr.co/auth/signin
, que no coinciden con la URL de su sitio web de prueba, esto generará el error como se esperaba.Deberá asegurarse de que las URL proporcionadas coincidan con el dominio de alojamiento.
Hello I really made a change of the url to be able to log me on the url of allowed calls and the return and I managed to redirect me to be able to log me by google the first url that I showed you did not work but with the url of the application that is the one you are mentioning if it worked for me. Now I am reviewing is the login with facebook which I have an error that the app is not active but I'm trying to validate that process thank you very much.
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
No response
Backend
None
Environment information
Describe the bug
Hi, I am trying to use the signInWithRedirect function to log in with google and facebook and in the platforms of each social network I have already added the urls to be able to make the redirections but when I want to redirect I get the following error “Uncaught (in promise) InvalidOriginException: redirect is coming from a different origin. The oauth flow needs to be initiated from the same origin” I don't know what I need to configure, I tried to adjust several processes and before I had version 4 of amplify and it worked, recently I updated to version 6.
Expected behavior
this is my configuration
Auth: { Cognito: { userPoolId: env.NEXT_PUBLIC_COGNITO_USERPOOL_ID, userPoolClientId: env.NEXT_PUBLIC_COGNITO_CLIENT_ID, signUpVerificationMethod: 'code', loginWith: { email: true, oauth: { redirectSignIn: [
${BASE_URL}/auth/signin
], redirectSignOut: [${BASE_URL}/auth/signin
], domain: env.NEXT_PUBLIC_COGNITO_DOMAIN, responseType: "code", scopes: ["email", "openid", "profile", "aws.cognito.signin.user.admin"] }, } } }Reproduction steps
this is my code
await signInWithRedirect({ provider: 'Google', customState: 'shopping-cart' });
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
Auth: { Cognito: { userPoolId: env.NEXT_PUBLIC_COGNITO_USERPOOL_ID, userPoolClientId: env.NEXT_PUBLIC_COGNITO_CLIENT_ID, signUpVerificationMethod: 'code', loginWith: { email: true, oauth: { redirectSignIn: [
${BASE_URL}/auth/signin
], redirectSignOut: [${BASE_URL}/auth/signin
], domain: env.NEXT_PUBLIC_COGNITO_DOMAIN, responseType: "code", scopes: ["email", "openid", "profile", "aws.cognito.signin.user.admin"] }, } } }Additional configuration
No response
Mobile Device
No response
Mobile Operating System
linux
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response