Closed SaileshKumar closed 2 years ago
Hi @SaileshKumar 👋 thanks for raising this issue. Did you only update the @aws-amplify/auth
package? It looks like that's in v4 but aws-amplify
is still in v3. Could you upgrade all your amplify packages to make sure they're compatible?
This page might help: https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js/
Otherwise, I noticed that you have two redirect signin and signout URLs. Are you making sure in your application that only one of them is being used in the oauth flow requests? You'll notice that they are in a single string, separated by a comma.
here's an example of getting just one URL from the docs: https://docs.amplify.aws/lib/auth/social/q/platform/js/#configure-auth-category
import awsConfig from './aws-exports';
const isLocalhost = Boolean(
window.location.hostname === "localhost" ||
// [::1] is the IPv6 localhost address.
window.location.hostname === "[::1]" ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
// Assuming you have two redirect URIs, and the first is for localhost and second is for production
const [
localRedirectSignIn,
productionRedirectSignIn,
] = awsConfig.oauth.redirectSignIn.split(",");
const [
localRedirectSignOut,
productionRedirectSignOut,
] = awsConfig.oauth.redirectSignOut.split(",");
const updatedAwsConfig = {
...awsConfig,
oauth: {
...awsConfig.oauth,
redirectSignIn: isLocalhost ? localRedirectSignIn : productionRedirectSignIn,
redirectSignOut: isLocalhost ? localRedirectSignOut : productionRedirectSignOut,
}
}
Amplify.configure(updatedAwsConfig);
Let me know if this helps!
Ahh you're right. Thank you so much!!
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels or Discussions for those types of questions.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
Unable to use Google Login
Expected behavior
Once login finishes - user returns to app logged in with no errors
Reproduction steps
Code Snippet
Log output
aws-exports.js
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
Seems to have happened after I upgraded Amplify, but unsure. I was affected by this issue FWIW: https://github.com/aws-amplify/amplify-cli/issues/8266