freshkitedev / LMS-Project

Welcome to the LMS / Learning Management System Full stack Project
1 stars 6 forks source link

Generate new token, user social authentication, get user #15

Closed Vishva77 closed 6 months ago

Vishva77 commented 6 months ago

Creating new Access Token by Using Refresh Token User social authentication Get user Information from database.

Vishva77 commented 6 months ago

updateAccessToken: Updates the access token using the refresh token. It verifies the refresh token, retrieves the user session from Redis, generates new access and refresh tokens, and sends them in response.

getUserById: Retrieves user information by ID from the database and sends it as a response.

getUserInfo: Retrieves user information based on the authenticated user's ID from the request object and calls getUserById to fetch user details.

ISocialAuthBody: Defines an interface specifying the structure of the request body expected for social authentication, including fields like name, email, and avatar.

socialAuth: Handles social authentication by checking if the user exists based on the provided email. If the user exists, it sends a token; otherwise, it creates a new user and sends a token.