Microsoft Graph API - Access a database after logging in - credential work flow

Asqueroso 1 Reputation point
2023-02-02T22:16:29.5166667+00:00

So i am using Microsoft Graph API with the JavaScript client, Im creating a React, Node/Express and PostgreSQL database. (might not be relevant to my question).

But i need to create a database in the backend where when a user login's i can CRUD there information in the database.

I'm familiar with creating this workflow using a username and password where i would bcrypt the password, compare the passwords, log them in, then they gain access to there site and database information with the ability to CRUD the database.

(heres an example of a flow i would use): https://www.bezkoder.com/react-express-authentication-jwt/

However, i have Microsoft Graph API doing the login and logout logic. So there is no password comparison. Whats the best way to go about this? Does Microsoft Graph API have a solution for this? I just need help wrapping my brain around going about this. thank you.

i believe it might be as simple as creating a token after a successful login but not sure how that flow would look like.

any help would be greatly appreciated. thanks

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,570 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. 2023-02-27T13:26:01.6066667+00:00

    Hi @Asqueroso, Here is the sample react based Sign in users and call the Microsoft Graph API from a React single-page app (SPA) using auth code flow: https://learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-react#sign-in-users


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments