SOLVED

Workbench test of isolated SPFx with Graph permissions

Iron Contributor

I am building an isolated SPFx Client Side Web Part that uses an aadHttpRequest to write events to a user's calendar. For this I need Calendars.ReadWrite delegated permissions.

My issue: when I test in the online workbench, I get a 403 error. I suppose this is because the Web Part hasn't been deployed yet, and the application registration with those permissions doesn't exist yet.

 

How can I address this chicken & egg issue, and test my Web Part before deploying it?

3 Replies
best response confirmed by Christophe Humbert (Iron Contributor)
Solution

@Christophe HumbertWell, you have to have global admin, so if you don't, you might be stuck.

 

If you do, though, then you could try to upload this incomplete version of the program, which will create the request for permission. Then grant the permissions, and delete your package from sharepoint. The permission request appears very simplistic in the admin console. It is my impression that as long as you keep the same ids and package names through the course of development, then your later and final versions will also get your permissions granted. I think it's not really tied to your actual SPFX package, except by the ids in the manifest. I could be wrong about that; my own attempts to do the same were cut short for unrelated reasons.

 

If your problem is not having global admin, you could try to get yourself a development tenant where you have admin privileges, that may be all you need to do your development. Then you won't have to ask an admin until you have something that's complete. IMHO you shouldn't have to have a complete project before the permission is granted, though.

 

The global admin part starts at step 4 in this document, although it's written as if one person would be doing all of this:

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-aad-tutorial#configure-the-api-permissions-...

Note also that there can be a strange pause before the menu options appeared in the admin console. If you read quickly, you might see a menu option in the document that isn't where it's supposed to be in your admin console. Just give it a minute, though.

Thanks! That confirms another source, I need to upload a draft version to do the proper initialization, then I can work on the solution itself.
I encountered the same problem; sending an email using GraphAPI doesn't work in the workbench. I installed the app in the app catalog and the installed version worked. However, the version running in the workbench still didn't work. Is there something I am missing?
1 best response

Accepted Solutions
best response confirmed by Christophe Humbert (Iron Contributor)
Solution

@Christophe HumbertWell, you have to have global admin, so if you don't, you might be stuck.

 

If you do, though, then you could try to upload this incomplete version of the program, which will create the request for permission. Then grant the permissions, and delete your package from sharepoint. The permission request appears very simplistic in the admin console. It is my impression that as long as you keep the same ids and package names through the course of development, then your later and final versions will also get your permissions granted. I think it's not really tied to your actual SPFX package, except by the ids in the manifest. I could be wrong about that; my own attempts to do the same were cut short for unrelated reasons.

 

If your problem is not having global admin, you could try to get yourself a development tenant where you have admin privileges, that may be all you need to do your development. Then you won't have to ask an admin until you have something that's complete. IMHO you shouldn't have to have a complete project before the permission is granted, though.

 

The global admin part starts at step 4 in this document, although it's written as if one person would be doing all of this:

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-aad-tutorial#configure-the-api-permissions-...

Note also that there can be a strange pause before the menu options appeared in the admin console. If you read quickly, you might see a menu option in the document that isn't where it's supposed to be in your admin console. Just give it a minute, though.

View solution in original post