Return to application without granting consent displays Error Message
Post the sign in, a page which prompts consent for the permissions needed for the application is displayed. On selecting "return to the application without granting consent" option an error message is displayed[screenshot attached].

I have followed the page by microsoft that is https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-authentication?view=azure-bot-service-4.0&tabs=aadv2%2Ccsharp and did the configuration in our bot with redirect URI as https://token.botframework.com/.auth/web/redirect. We are using the OauthPrompt to sign in the user in our MS Teams bot application.
If anybody has any resolution for the issue, then please let me know. Thanks in Advance
Hi @ManuNswamy
Thank you for bringing this to our attention. I'm going to attempt a repro of this issue: in the meantime, can I get a few more details: Are you using any of our samples as the base for this bot, such as the Sample 18. Bot Authentication or Sample ## Authentication with MSGraph? Which language SDK are you using? Are you using AADv1 or AADv2?
Thank you!
We are not using any of the samples. Our application is built using C# with AADv2,
Looking into this. Will attempt a repro on my end and update the thread.
@ManuNswamy, apologize for the delay in response. I am unable to repro the issue on my end. As soon as I connect to the Teams channel and sign in, it does not open the page which prompts consent for the permissions needed for the application is displayed, but just logs me in with an option to view the token. Could you elaborate on the steps that led you to getting the ServiceError?

Closing due to no response. Please feel free to re-open if issue persists.
Hi Team,
My sincere apologies for not responding to the thread.
The scope used in azure connection settings AADv2 is openid profile email User.Read Group.Read.All ChannelMessage.Send
To get a prompt for consent window, you will have to add the scope as mentioned above. Do let me know if there is any more information needed.
@ManuNswamy, thanks for the additional information above. Let me repro the issue with the above scopes and get back with my findings.
@ManuNswamy, here are my repro steps:
-
As soon as I connect to the Teams channel, I get this:

-
When I click on 'Sign in', it prompts me to the Microsoft Sign In page and post the sign in, I get this page asking for permissions:

- I am still not able to get the "return to the application without granting consent" option . Only when I click on the No option, I get the ServiceError.

- This is the scope of my AADv2 OAuth Connection settings on Azure, 'openid profile email User.Read Group.Read.All ChannelMessage.Send'

Please let me know if I am missing on any steps.
Thank you reproducing the scenario. I see that you were able to get the ServiceError which is the similar to what we were getting during the sign in, so could you please provide us any details that you possibly resolve the issue because we had raised the bug to handle the ServiceError ?
To get the "Return to application without granting consent" option, could you please try to login using a general user without any specific roles or permissions [Atleast roles should not be Global Administrator, Application Administrator, or Cloud Application Administrator]?
Attaching the screenshot of the consent window that we see during the sign in

@anusharavindrar Were you able to repro the scenario? Any resolution step to have the Service Error fixed?
Thanks in Advance !
@ManuNswamy, currently investigating this further. Will update the thread as soon as I have some more info to share. Thanks for your patience.
@ManuNswamy, I was able to repro the scenario and got the ServiceError. I am currently working internally to get more information on the ServiceError and the expected behavior.
@anusharavindrar can you please flag a Milestone for this issue? Thanks.
@ManuNswamy,
For the first part i.e., if you want the consent to work, then you need to figure out the the admin consent part about your tenant and try out these 3 options –
- The end user is an admin in the tenant, and can click the “Have an admin account” link below and grant consent.
- A global admin provides consent at the app level for all users in the tenant - https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/grant-admin-consent#:~:text=Grant%20admin%20consent%20in%20App%20registrations&text=Select%20Azure%20Active%20Directory%20then%20App%20registrations.,the%20permissions%20the%20application%20requires.
- Remove the scopes that need admin consent.
For the second part, which is the ServiceError you get when you select “return to the application without granting consent”, it would be a feature work that needs to be planned and completed based on the priority of our team. I will link the feature work item here once its created and you can track its progress.
Thanks Team for reproducing the issue and considering it as a feature work.
Hi @ManuNswamy : I'm closing this primary issue - we can follow progress in the linked issue. Thanks for reporting the issue!