Open umalhotra86 opened 1 week ago
Hi @umalhotra86 Thank you for using Teams Toolkit. UiRequiredError is expected when user have not consented permission for the app. When getting this error, you need to popup login page for user to consent using the following lines:
await teamsUserCredential!.login(["YOUR_PERMISSION"]);
@KennethBWSong Already taking care of this in the logic. Before requesting for token, we ensure that login call has succeded. Shared below the function that ensures this.
public validateToken = async (scopes: any) => { try { await teamsUserCredential?.getToken(scopes); } catch (error) { await teamsUserCredential?.login(scopes); } };
Describe the bug Teams tab application is failing to load. This error is observed in console - Uncaught (in promise) CP.UiRequiredError: Failed to get access token cache silently, please login first: you need login first before get access token.
To Reproduce Steps to reproduce the behavior:
Expected behavior Access token will be retireved and API calls to web API's hosted on azure will succeed.
Screenshots
OS
Node version/ Script references