gsj
12/29/2023, 10:57 AMError: Getting userInfo failed with 401: {"message":"Bad credentials","documentation_url":"https://docs.github.com/rest"}
at Object.originalImplementation.getUserInfo (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\recipe\thirdparty\providers\github.js:86:23)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Object.signInUpPOST (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\recipe\thirdparty\api\implementation.js:35:30)
at Object.signInUpAPI [as default] (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\recipe\thirdparty\api\signinup.js:68:18)
at Recipe.handleAPIRequest (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\recipe\thirdparty\recipe.js:73:24)
at Recipe.handleAPIRequest (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\recipe\thirdpartyemailpassword\recipe.js:63:24)
at SuperTokens.middleware (C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\supertokens.js:195:38)
at C:\Users\gouta\supertokens-customapp\backend\node_modules\supertokens-node\lib\build\framework\express\framework.js:128:28
anyone faced the same issue and got it resolved kindly share the solution. thanksrp_st
12/29/2023, 12:16 PMrp_st
12/29/2023, 12:16 PMrp_st
12/29/2023, 12:16 PMgsj
12/29/2023, 12:21 PMimport React, { useEffect } from 'react';
import ThirdPartyEmailPassword from 'supertokens-auth-react/recipe/thirdpartyemailpassword';
const AuthCallbackView: React.FC = () => {
useEffect(() => {
const fetchData = async () => {
try {
const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({});
if (response.status === "OK") {
console.log(response.user)
if (response.createdNewRecipeUser && response.user.loginMethods.length === 1) {
// sign up successful
console.log('sign up successful------------------>');
} else {
// sign in successful
console.log('sign in successful------------------>');
}
window.location.assign("/homepage");
} else if (response.status === "SIGN_IN_UP_NOT_ALLOWED") {
// this can happen due to automatic account linking. Please see our account linking docs
} else {
// SuperTokens requires that the third party provider
// gives an email for the user. If that's not the case, sign up / in
// will fail.
// As a hack to solve this, you can override the backend functions to create a fake email for the user.
window.alert("No email provided by social login. Please use another form of login");
window.location.assign("/auth"); // redirect back to login page
}
} catch (err: any) {
if (err.isSuperTokensGeneralError === true) {
// this may be a custom error message sent from the API by you.
window.alert(err.message);
} else {
window.alert("Oops! Something went wrong with SSO Auth.");
}
}
};
fetchData();
}, []);
return null; // Or you can render some loading indicator if needed
};
export default AuthCallbackView;
rp_st
12/29/2023, 12:23 PMgsj
12/29/2023, 12:28 PMgsj
12/29/2023, 12:30 PMrp_st
12/29/2023, 12:32 PMgsj
12/29/2023, 12:35 PMgsj
12/29/2023, 12:38 PMrp_st
12/29/2023, 12:38 PMrp_st
12/29/2023, 12:38 PMrp_st
12/29/2023, 12:39 PMgsj
12/29/2023, 12:44 PM