Disable login page while checking rights for another site collection in SPFx

Brass Contributor

Dear Ladies and Gentlemen,

 

is there a way how I can disable login page while checking rights of current user for another site collection in SPFx?

 

In SharePoint Framework I use following import statement:

 

import { PermissionKind, Web } from '@pnp/sp';


In the method I write following code:

 

let web = new Web(webUrl);

const perms = await web.currentUserHasPermissions(PermissionKind.ViewListItems);

 


When current user has rights for the site, then I receive true.
When not, then I receive after 15 times trying to login the error message: ERR_TOO_MANY_RETRIES
I would like to get false in this case without the login page appearing.
Is there a way how I can disable the popup of the login page for a while?

 

Thank you very much for help.

Ladislav Stupak

 

0 Replies