Yes, this scenario can be implemented.
If you want to have users from multiple different tenants log in to your app, then you must configure your app as a multi-tenant app.
When logging in, you will need to change /{tenant id}
to /common
to allow accounts from different tenants to log in.
GET https://login.microsoftonline.com/common/oauth2/v2.0/authorize?
client_id=xxxxxxxxx
&response_type=code
&redirect_uri=xxxxxxxxxx
&response_mode=query
&scope=Calendars.ReadWrite
&state=12345
Redeem the access token using the authorization code:
POST https://login.microsoftonline.com/common/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded
client_id=xxxxxxxxx
&scope=Calendars.ReadWrite
&code=OAAABAAAAiL9Kn2Z27UubvWFPbm0gLWQJVzCTE9UkP3pSx1aXxUjq3n8b2JRLk4OxVXr...
&redirect_uri=xxxxxxxxx
&grant_type=authorization_code
&client_secret=xxxxxxxxxxx
Hope this helps.
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.