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

David Cotto 1 Reputation point
2023-02-02T22:12:30.17+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 Security Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Srinivasa Rao Darna 6,761 Reputation points Microsoft External Staff
    2023-02-03T07:13:40.0966667+00:00

    Hello @David Cotto ,

    Thanks for reaching Microsoft QnA!

    You can refer Username/password (ROPC).

    User's image

    It is not recommended to use ROPC and it will have several limitations.

    https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows#constraints-for-ropc

    Hope this helps.

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


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.