Removing earlier permissions consented by Users from scope/accesstoken for MS Team App.

Shubhi Saxena 1 Reputation point
2020-08-27T08:07:26.6+00:00

Urgent help required! Thanks

I have created a bot service and connect with AAD to let user login to their Microsoft O365 Delegated permission and can change the permission in the future like the attached image

20851-image.png

First i login the user with two scopes (scope1 & scope2) and received the accesstoken for these two permission.

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?
client_id=<client_id>&response_type=code&redirect_uri=<r_url>&response_mode=query&state=<somestate>&
scope=<scope1 scope2>
&prompt=consent

Response :

{.., scope:"scope1 scope2",...}  

But when i change the scope to only scope1 it is still giving me both the scope with accesstoken.

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?
client_id=<client_id>&response_type=code&redirect_uri=<r_url>&response_mode=query&state=<somestate>&
scope=<scope1>
&prompt=consent

Response : {.., scope:"scope1 scope2",...}

How can i dynamically provide scope while login or how to logout the user so that previous scope will be removed and fresh scope can be provided?

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
840 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,319 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,061 questions
{count} votes

1 answer

Sort by: Most helpful
  1. soumi-MSFT 11,781 Reputation points Microsoft Employee
    2020-08-31T06:12:15.047+00:00

    @Shubhi Saxena , I would like to share an update with you that on something that I recently discovered. When you make a call to the /authorize endpoint of AAD, irrespective of the fact that how may scopes you add in the request, when the code is issued by AAD, it would be adding up all the consents that have been consented until then in the code. This is termed as additive scopes. Now whatever is present in the code, the same scopes get added to the token.

    I tested it out and also got some confirmation from the backend product team also on this.

    Hope this helps.

    Do let us know if this helps and if there are any more queries around this, please do let us know so that we can help you further. Also, please do not forget to accept the response as Answer; if the above response helped in answering your query.


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.