How to cancel user consent to a web application - azure-active-directory

I recently logged into a web application and I got the standard user consent dialog.
I clicked "Accept".
How do I get to that dialog again or cancel?
Thanks

You cannot cancel the user's consent to the web application through the UI. You can revoke the administrator's consent to the application through the Azure portal. However, this obviously does not apply to the user's consent.
However, you can cancel user consent through power shell. First go to Enterprise Applications>your application>Permissions>User consent and you will see all user consent permissions.
Next, you can then click Review permissions -> This application has more permissions than I want. This will give you a PowerShell script that you can run to remove all user consent for that application. It can of course be customized to only remove certain permissions.

Related

Azure AD sign in for mobile application remove prompt consent

Is it possible to remove the consent prompt when user sign in to the mobile application?
Please check if below points can help:
For the mobile app registered in azure ad,please make sure the api permissions like delegated user permissions (This will allow minimum compulsory permissions to be needed .) added are given/granted consent in portal itself by admin. If required add users to the application that dont need consent .
If you want the user to be verified first by the admin , don't grant it and grant after the login request for the first time.
For users in your tenant to allow access to the application, please
Go to your Azure AD > Enterprise Applications > User settings > Admin consent requests
Here select Users can request admin consent to apps they are unable to consent to to Yes .
For ‘Who can review admin consent requests’, select the users and groups whom you can allow to review the admin consent for the application and set the days till when this consent is not required for those user. This way users in your tenant will not receive the admin consent prompt while trying to access the application.
Select Allow user consent for apps in User consent settings pane if you permanently need to remove consent for all applications in your tenant.

Graph Explorer: Need admin approval

https://graph.microsoft.com/v1.0/me/sendMail
I am trying to call sendMail in graph and received error:
Graph explorer (official site) needs permission to access resources in your organization that only an admin can grant. Please ask an admin to grant permission to this app before you can use it.
I understand that I need to ask an admin, but I don't know who to ask or what the procedure is like. My tenant is "Microsoft"
Thanks for any input!
The application requires one or more permissions which only Global Admin can consent for. There are some permissions for which standard users can provide consent but if the application needs high-level permission with which any changes can be made to the directory, the above message is displayed and only the Global Administrator can consent to those permissions.
So you would need to contact Global Administrator to provide consent. for microsoft.com tenant, you can open a request here. Please refer to a similar question it may help you
You have granted the application permission without the admin consent. The easiest way is to redirect the user to the administrator consent endpoint, then log in with the administrator account, and click the Accept button to grant the administrator consent for your application.
You need to request the URL in your browser:
https://login.microsoftonline.com/{tenant_id}/adminconsent?client_id={client_id}

Azure APP registration - Even after granting admin consent,end user still gets login window asking for Permission

We have created APP registration in Azure tenant. After adding all necessary Graph API permissions to APP and clicking "Grant admin consent" button, end-user still receives a window with "Permissions requested".
However, if I log in to my APP from Windows using my Tenant admin, on the same login window there is a checkbox saying "Consent on behalf of your organization". Checking this box as an admin suppresses any subsequent windows from showing for any user.
Why is that? Why clicking Grant admin consent in API Permissions tab does not behave the same way as logging first as a tenant admin and checking the box "Consent on behalf of your organization"?
Please let me better understand this.
API Permissions
Permissions requested window
The lack of Mail.Send.Shared permissions is not the cause of the problem.
When you log in to the application as a normal user for the first time, the system will prompt you whether to accept the request permission of the application. After you click "Accept", the request window will not pop up when you log in to the application next time. It's not because you added the Mail.Send.Shared permission.
We have many ways to grant administrator consent for api permissions. You can click "Grant admin consent" in the "API permissions" tab, or check the "Consent on behalf of your organization" box when logging in to the application. The realized functions are all the same.

Azure OAuth2 flow when approval is requested

Our app implements Azure OAuth2 (v2) user-consent flow and uses Graph API scopes that do not require admin consent oauth2 user. Recently we've noticed that some users of our app run into this Auth screen: "The app requires admin's approval".
Is that because the tenant Org disabled user-consent for apps?
Where does it leave us with the user-consent based OAuth2 flow? Is it still possible to get a user access token after an admin's approval or the only way is to use the OAuth2 daemon flow oauth2 daemon? In a callback after such a dialog how can we know that the admin approval has been given?
One related question. In cases where user-consent is not disabled but it's an admin user that authorizes there is an option 'Consent on behalf of your Organization". How can we know in the callback from this dialog that the admin checked that box? And does it mean we need to use the OAuth2 daemon flow then too?
Thank you
It was our lack of understanding. After more testing we realized that we used prompt=consent and that is why the consent window always showed. Thank you.
Is that because the tenant Org disabled user-consent for apps?
Yes, this settings is under Enterprise applications->User settings.
Is it still possible to get a user access token after an admin's
approval
Yes, you can still get a user access token after an admin's approval.
In a callback after such a dialog how can we know that the admin
approval has been given?
Once your admin reviews the request you will be notified via email.
In cases where user-consent is not disabled but it's an admin user
that authorizes there is an option 'Consent on behalf of your
Organization". How can we know in the callback from this dialog that
the admin checked that box?
Once the admin checked the box, the users under that tenant will not see the consent dialog. Also, you can check the status of the application in Azure portal->App registrations->your app->API permissions.
There are two possible reasons users consent or adminconsent
For user consent two possible cases
1)In a tenant where user consent is disabled, for example, users can't consent to any permission. Azure AD-- > Enterprise apps ---> User settings ---> Users can consent to apps.
2) User assignment :Azure AD--- > Enterprise apps-- > (select app) --> Properties --> User assignment required
For Admin Consent two possible cases
1) App-only permissions always require a tenant administrator’s consent. If your application requests an app-only permission and a user tries to sign in to the application, an error message is displayed saying the user isn’t able to consent.
2) Certain delegated permissions also require a tenant administrator’s consent. For example, the ability to write back to Azure AD as the signed in user requires a tenant administrator’s consent.
Solution :
The prompt=admin_consent parameter(which request permissions from admin) can be used as a parameter in the OAuth2/OpenID Connect authorization request to grant the admin consent .
Enable the admin consent workflow , which gives end users a way to request access to applications that require admin consent.
Refer the permissions documentation for the Microsoft Graph API indicate which permissions require admin consent.

How to get offline access in google api without prompting the user

I got basic profile info permission from a user through my google app. And now i newly added "access_type=offline" in the api call. It will prompt the user in consent screen like "Have offline access". How do i avoid this screen and get automatically offline access from user without consent screen.
My api call:
https://accounts.google.com/o/oauth2/auth?client_id=CLIENTID&redirect_uri=REDIRECTURI&scope=email+profile+https://www.googleapis.com/auth/drive.readonly&response_type=code&access_type=offline&state=12345678909876543
in the above url i added access_type=offline newly. So it display a consent screen like "Have Offline Access". help me to get offline access from user without prompting the consent screen while user clicks my google app from their account.?
Thanks in advance.
It is not possible to get offline access without user consent.
But maybe you don't need offline access. When you have an administator install your app through gsuite marketplace, you can use a service account to do stuff in the users drive by impersonating.
That way you don't need each user of your domain to give consent.
Be aware that you cannot use the service account for everything. For instance: you cannot impersonate a user and than call an appscript script.

Resources