Microsoft Authentication using nextAuth

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

My frontend is built in next.js and i am doing authentication using NextAuth. I have successfully enabled the google provider, and can authenticate both my frontend and strapi access using it. The flow is more or less, nextauth sends authentication request to google, gets a token, and then sends that to strapi to authenticate.

I am now facing issues when trying to implement the microsoft provider. The authentication works for the frontend, and i can verify that its successfull through the azure portal. However, sending that token to strapi via the same code used for the other providers is giving me an

'Insufficient privileges to complete the operation.


From my digging it seems that i need to grant some privileges to my app in azure, however i cant figure out exactly which grants that strapi requires.

Does anyone have any experience with this and could offer some advice? Happy to post more code if that’s of interest.


In case anyone finds this I managed to figure it out. The scope that Strapi is requesting is the " " permission. I had been using only the “openid profile” scope in my nextauth provider definition, but adding the aforementioned scope fixed the problem.

1 Like

Thanks a lot for this tip, I was stuck for many days until I read your topic