title: Scoped application request for Microsoft Graph, in NodeJS
body: <p>Ive been researching the MS Graph API lately, and I'm running into a problem. My use case is that I want to read a certain mailbox's mail, and send mail for that mailbox. The mailbox is a non user related box, and is used as a service account for emails.</p>
  
  <p>Ive found 2 possible flows for getting into that mailbox. The user authenticated flow, and the application (and admin consented) flow. For the application, I want to read the emails in the background in a NodeJS app, without user interaction.</p>
  
  <p>When I look into the user consented flow, I find that to make it work the user HAS to log in atleast once, by hand, and consent to some stuff I want to do. I found <a href="https://docs.microsoft.com/en-us/graph/auth-v2-user" rel="nofollow noreferrer">this</a> page, on how this works, and made it work in my NodeJS app. The problem is, when using this flow, I have to login BY HAND atleast once after starting my NodeJS app. Afterwards I can use the refresh token to refresh the access token, but I dont want to do the login by hand.</p>
  
  <p>The second option, and most suitable option for my NodeJS app, is the application flow. I found <a href="https://medium.com/@fiqriismail/how-to-get-an-access-token-for-microsoft-graph-api-using-node-js-258723f29cc6" rel="nofollow noreferrer">this</a> tutorial on how to do that, and I made it all work. I fetch a token, and that token grants me access to the box via the Graph API. </p>
  
  <p>But using the application flow, I found that I have to have the roles (i.e.): "User.ReadAll, Mail.Read, Mail.Send". This gives my application rights to read and send mail FOR ALL users in the account.. Which is WAY too much overkill for my situation.</p>
  
  <p>Now my question; Is there a way for me to use MS Graph, with the application authentication flow, but without having access to all users' mailboxes, only to my specific account I want to read?</p>
  
  <p>Thanks in advance,
  Caspar</p>