I'm getting an OAuthNotConfigureException: oauth param not configured error when trying to use Google OAuth with AWS Amplify v6, even though my configuration appears correct.
Environment:
- AWS Amplify v6.15.1
- Next.js 14.2.30
- AWS Cognito User Pool with Google Identity Provider
- Google OAuth 2.0 credentials configured
Current Configuration:
// src/config/amplify.ts
import { Amplify } from 'aws-amplify';
const amplifyConfig = {
Auth: {
Cognito: {
userPoolId: "userPoolId",
userPoolClientId: "userPoolClientId",
signUpVerificationMethod: "code",
loginWith: {
email: true,
phone: false,
username: false
},
userAttributes: {
email: { required: true },
name: { required: true }
},
socialProviders: {
google: {
clientId: "clientId"
}
}
}
},
oauth: {
domain: "domain",
scope: ["email", "openid", "profile"],
redirectSignIn: "http://localhost:3000/signin",
redirectSignOut: "http://localhost:3000/",
responseType: "code",
providers: ["Google"]
}
};
Amplify.configure(amplifyConfig);
Error Details:
OAuthNotConfigureException: oauth param not configured.
at assertOAuthConfig (webpack-internal:///./node_modules/@aws-amplify/core/dist/esm/singleton/Auth/utils/index.mjs:33:62)
at signInWithRedirect (webpack-internal:///./node_modules/@aws-amplify/auth/dist/esm/providers/cognito/apis/signInWithRedirect.mjs:53:89)
Code that triggers the error:
// src/contexts/AuthContext.tsx
const signInWithGoogle = async () => {
try {
await signInWithRedirect({ provider: 'Google' });
} catch (error) {
console.error('Google sign in error:', error);
throw error;
}
};
Debug Output: The configuration is being loaded correctly as shown in the console:
{
"Auth": {
"Cognito": {
"userPoolId": "userPoolId",
"userPoolClientId": "userPoolClientId",
// ... rest of config
}
},
"oauth": {
"domain": "domain",
// ... rest of oauth config
}
}
What I've tried:
- Moving OAuth config inside
Auth.Cognito - Using different OAuth configuration formats
- Verifying all environment variables
Additional Context:
- The error occurs specifically when calling
signInWithRedirect({ provider: 'Google' }) - The configuration loads without errors during
Amplify.configure() - This is a fresh setup with no previous Amplify configurations
Any help would be greatly appreciated! This seems like a configuration issue specific to Amplify v6's OAuth implementation., should I use v5?