sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Web API Permission Requests are shown twice in API Management

Open rbarten opened this issue 8 years ago • 16 comments

Category

  • [ ] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

When a SPFx solution is installed the Web API Permission Request should be showed once in the API management.

Observed Behavior

When I install a SPFx solution with 'webApiPermissionRequests', the API Management shows the same request twice in Pending Approval. 2018-02-22 10_41_22-sharepoint admin center preview

Steps to Reproduce

Install a SPFx solution with one webApiPermissionRequest.

"webApiPermissionRequests": [
     {
        "resource": "**********.SPFx.API",
        "scope": "user_impersonation"
      }
    ],

Tried several different solutions, all have the same issue in our tenant.

rbarten avatar Feb 22 '18 09:02 rbarten

What are the exact steps that you're following? Every time you deploy the solution in the app catalog, a new permission request will be added to the list. Could it be, that you deployed your solution multiple times?

waldekmastykarz avatar Feb 26 '18 11:02 waldekmastykarz

I'm able to reproduce it by dragging and dropping a solution in the App Catalog and overwritting an existing solution. Next I check-in the file. After drag/dropping the package, it's checked out in the library and only one approval request is added. When I check-in the file, the second Approval Request is created for the same solution.

rbarten avatar Feb 26 '18 19:02 rbarten

Right, so the solution has been previously deployed and you're updating it, which triggers re-issuing the permission requests from the solution.

waldekmastykarz avatar Feb 28 '18 16:02 waldekmastykarz

The UX here has a few issues. Here's a (not complete) list of what we are addressing around here. Errors will be reported in the UX (not as a red line saying 400 error), duplicates won't show up, and each permission for the same service scope will appear separately (so 4 permissions against graph will show up as 4 lines).

patmill avatar Mar 19 '18 23:03 patmill

Web API Permission Request is not showing in my API Management.

The follwing are the steps followed by me. 1.Creating WedAPI in visual studio . 2.Creating app in azure. 3.Adding WebAPI in created app (appname:-AADApp). 4.Creating SPFX solution. 5.Adding WebAPIpermissionrequest as "webApiPermissionRequests": [
{ "resource": "AADApp", "scope": "User.ReadBasic.All" }] 6.Deployed solution of an spfx in appcatalog. 7.Added int o sitecontents. 8.Here it's not showing any permissions to approve in apimanagement.

tejyapranthi avatar Mar 29 '18 06:03 tejyapranthi

Was the solution deployed without any errors?

waldekmastykarz avatar Mar 29 '18 10:03 waldekmastykarz

The other thing to check is if it was deployed less than 20 minutes after you created the app catalog. If it was, redeploy and they will appear.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Waldek Mastykarz [email protected] Sent: Thursday, March 29, 2018 3:05:07 AM To: SharePoint/sp-dev-docs Cc: Pat Miller (SHAREPOINT); Comment Subject: Re: [SharePoint/sp-dev-docs] Web API Permission Requests are shown twice in API Management (#1389)

Was the solution deployed without any errors?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/SharePoint/sp-dev-docs/issues/1389#issuecomment-377187715, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADl-SUwHEZIB8cWlwb_69vOPrq4WlgFwks5tjLHTgaJpZM4SPBT-.

patmill avatar Mar 29 '18 13:03 patmill

no ,there were no errors when solution deployed and it is less than 20 minutes after deployment done in my app catalog. I am also getting error like"Uncaught (in promise) Error: This operation cannot be performed until the AadTokenProvider is initialized." in workbench.html. when I am performing "gulp serve".

-> when i deployed solution in app catalog and with out approving permissions i am using the spfx web part . But here it was showing error like

sp-pages-assembly_en-us_bbf1ba8e18797f770e10fb0068654369.js:602 Uncaught (in promise) Error: AADSTS50001: The application named "--application name is here--" was not found in the tenant named "--tenant name is here--". This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant. Trace ID: 55be378a-bf9e-47ef-847d-48067a170e00 Timestamp: 2018-03-30 07:35:02Z at Array. (sp-pages-assembly_en-us_bbf1ba8e18797f770e10fb0068654369.js:602) at _callBackMappedToRenewStates.(/sites/DLRDestination/SitePages/anonymous function)._callBackMappedToRenewStates.(anonymous function) (https://spoprod-a.akamaihd.net/files/sp-client-prod_2018-03-16.021/0.sp-http-adal_4a41848c866052caa755.js:3:7561) at AuthenticationContext.handleWindowCallback (adal.min.js:2) at parseTokenFromUrl (spfxsinglesignon.aspx:23) at onload (VM1413 spfxsinglesignon.aspx:30)

tejyapranthi avatar Mar 30 '18 06:03 tejyapranthi

Right, so the solution has been previously deployed and you're updating it, which triggers re-issuing the permission requests from the solution.

Is there any plan to address this? Or is there an alternate way to update a solution? Having to tell a user to delete requests anytime they update our app isn't an ideal solution.

lworkman avatar Nov 28 '18 21:11 lworkman

Hey @lworkman - is your question "will the admin page stop showing requests for scopes that have already been granted"? If so, the answer to that is yes. It's a bug, and we will get it cleaned up.

patmill avatar Nov 28 '18 23:11 patmill

Thanks for the info @patmill - is there an github issue somewhere I can subscribe to?

lworkman avatar Nov 28 '18 23:11 lworkman

Not that I am aware of. I know we have our own "clean up the admin UX" work item on our backlog.

patmill avatar Nov 28 '18 23:11 patmill

@patmill any progress on this? During development this means getting LOTS of requests in the admin panel. Also, it seems there is a limit of 100 items that are being shown in the list.

nse7ens avatar Mar 18 '19 15:03 nse7ens

'Also, it seems there is a limit of 100 items that are being shown in the list.' - indeed there is a limit in /PermissionRequests endpoint and those /Deny calls seem to be a workaround here (kind of server side cleanup driven by client side script) - each call 'abandons' single past deployment; so basically - (1) if you deploy new version of SPFx packages quite often and (2) you don't access 'API access' page in SP admin on daily basis (i.e. during morning cup of coffee) THEN you notice how messy (and funny) this design is;

what I can advice is to add an extension to your browser (there are many e.g. in Chrome Web Store) that reloads the page after specified delay - in this case 15 seconds was enough for us (you need to refresh page and wait few seconds for those 100 calls to complete - they are pretty quick though) - and leave it for some time (minutes/hours - depending i.e. on how early you realized about this design flaw) - after this you should be able to approve new permission requests (however I'm not sure how it looks if there are more than 100 permissions being used on single tenant in total - thankfully we have not reached this point on our environment so far);

ghost avatar Jun 21 '21 09:06 ghost

This issues should be fully solved and fixed, given the work we have done in engineering in this area. To ensure that we clean up the backlog of the issues, we will be closing this one. If you still have issues on this particular area, please open up a new issue so that we can get updated issue description and reproduce steps. We do apologize the non-optimal handling of these old issues and are looking into improving this in future.

VesaJuvonen avatar Nov 01 '21 17:11 VesaJuvonen

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

ghost avatar Nov 08 '21 18:11 ghost