Reputation: 8993
I am getting an error when trying to sign-in to my single-page application (SPA) using the signInWithRedirect
export of the aws-amplify/auth
node package and using Google as a Social Identity Provider.
For my setup, I have done the following:
[email protected]
packageimport { Amplify } from 'aws-amplify'
import { signInWithRedirect } from 'aws-amplify/auth'
Amplify.configure({
Auth: {
Cognito: {
loginWith: {
oauth: {
domain: '{MY_COGNITO_DOMAIN}',
redirectSignIn: ['http://localhost:5173/'],
responseType: 'code',
scopes: ['email', 'openid']
}
},
userPoolClientId: '{MY_USER_POOL_CLIENT_ID}',
userPoolId: '{MY_USER_POOL_ID}'
}
}
});
const signInWithGoogle = () => {
signInWithRedirect({
provider: 'Google'
})
}
When the signInWithGoogle
method is invoked in web application, the browser's network tab shows the following requests:
/oauth2/authorize
endpoint; this responds with a 302 HTTP status, redirecting to https://accounts.google.com/o/oauth2/v2/auth
/oauth2/idpresponse
endpoint/oauth2/idpresponse
Cognito endpoint responds with a 302, redirecting to a /error
page on the same domain, which responds with a 400 - Bad RequestThe Cognito error page that is the terminus of this flow displays the following message:
Missing required parameters
Missing required parameter client_id in request URL.
This is where I am stuck. As far as I understand, Cognito and Google do all the magic of constructing these redirect URLs and, presumably, each should be providing in the request parameters all of the data that the other requires. I don't know what I can change, or where, to get this client_id
passed from Google to Cognito.
Upvotes: 1
Views: 187