Forum Discussion

thangluu's avatar
thangluu
Copper Contributor
Feb 11, 2020

Guest invited can't use graph api upload file to sharepoint site b2b Azure app

I create AAD B2B App config my webapp and my azure portal to able invite guest user .

My webapp success use graph api to upload file if I use OTP method (one time passcode) to invite guest.

But when I disable OTP and invite guest and the guest user use password to login.

Guest user login success but when call graph api to upload file same way as above -> webapp throw error "AADSTS65001 - The user or administrator has not consented to use the application"

 

Note: My AAD B2B app added permissions : Files.ReadWrite.All (graph)

and I success if use OTP method for guest login to app. but failed when use password method.

 

 

 

My sharepoint added permissions  for the guest able access and upload to site

Please expain for me. Both two user after invite I see in my azure usertype is : Guest.

but source one is OTP one is External Auzre Active Directory

 

 

Error throw from : 

AuthenticationResult result = null;



var idClient = ConfidentialClientApplicationBuilder.Create(appId)
.WithRedirectUri(redirectUri)
.WithClientSecret(appSecret)
.Build();
var tokenStore = new SessionTokenStore(idClient.UserTokenCache,
HttpContext.Current, ClaimsPrincipal.Current);

var accounts = await idClient.GetAccountsAsync();


result = await idClient.AcquireTokenSilent(scopes, accounts.FirstOrDefault())
.ExecuteAsync();

No RepliesBe the first to reply

Resources