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

%3CLINGO-SUB%20id%3D%22lingo-sub-1992673%22%20slang%3D%22en-US%22%3EDisable%20login%20page%20while%20checking%20rights%20for%20another%20site%20collection%20in%20SPFx%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1992673%22%20slang%3D%22en-US%22%3E%3CP%3EDear%20Ladies%20and%20Gentlemen%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eis%20there%20a%20way%20how%20I%20can%20disable%26nbsp%3Blogin%20page%20while%20checking%20rights%20of%20current%20user%20for%20another%20site%20collection%20in%20SPFx%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20SharePoint%20Framework%20I%20use%20following%20import%20statement%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eimport%20%7B%20PermissionKind%2C%20Web%20%7D%20from%20'%40pnp%2Fsp'%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EIn%20the%20method%20I%20write%20following%20code%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Elet%20web%20%3D%20new%20Web(webUrl)%3B%3C%2FP%3E%3CP%3Econst%20perms%20%3D%20await%20web.currentUserHasPermissions(PermissionKind.ViewListItems)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EWhen%20current%20user%20has%20rights%20for%20the%20site%2C%20then%20I%20receive%20true.%3CBR%20%2F%3EWhen%20not%2C%20then%20I%20receive%20after%2015%20times%20trying%20to%20login%20the%20error%20message%3A%20ERR_TOO_MANY_RETRIES%3CBR%20%2F%3EI%20would%20like%20to%20get%20false%20in%20this%20case%20without%20the%20login%20page%20appearing.%3CBR%20%2F%3EIs%20there%20a%20way%20how%20I%20can%20disable%20the%20popup%20of%20the%20login%20page%20for%20a%20while%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20very%20much%20for%20help.%3C%2FP%3E%3CP%3ELadislav%20Stupak%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1992673%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional 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