📝 create documentation for user provision and authentication

This commit is contained in:
Rafi Arrafif
2025-08-13 11:13:19 +07:00
parent 1ebcc8d21d
commit c1adb767e7
2 changed files with 11 additions and 7 deletions

View File

@ -17,12 +17,6 @@ export const OAuthUserProvisionService = async (
providerRawCallback: unknown,
userHeaderInfo: UserHeaderInformation
) => {
/**
* Create auth session if user already exist,
* create user account and give them auth session if not
*
* This is just example!!
*/
try {
const providerId = `${payload.providerName}_${payload.openId}`;
const findUserResult = (await findUserService({
@ -34,7 +28,12 @@ export const OAuthUserProvisionService = async (
if (findUserResult) {
return await createUserSessionService(findUserResult.id, userHeaderInfo);
} else {
return "Not Found";
/**
* === TODO ===
* If the user is not found,
* create a new one with the data obtained from the OAuth provider,
* then create a user session and authenticate it immediately.
*/
}
} catch (error) {
ErrorForwarder(error);