Custom OAuth2 Social Connection with Cognito Returns Error "Invalid user id"
Last Updated:
Overview
When setting up a Custom Open Authorization 2 (OAuth2) Social connection with Cognito, the user is redirected to an error page during login attempts.
The error message displays the following: "Invalid user id"
Applies To
-
Custom OAuth2 Social connection
-
Cognito
Cause
This error occurs because a fetch user profile script is not implemented for the connection:
function(accessToken, ctx, cb) {
const profile = {};
// Call OAuth2 API with the accessToken and create the profile
cb(null, profile);
}Solution
-
Configure the fetch user profile script to resolve the issue.
-
Refer to Fetch user profile script for configuration details.