Access Token is not refresh on SPFx Personal Teams App on Android Mobile - Unable to Call Graph API
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
💥 SharePoint Framework
Developer environment
None
What browser(s) / client(s) have you tested
- [ ] 💥 Internet Explorer
- [ ] 💥 Microsoft Edge
- [ ] 💥 Google Chrome
- [ ] 💥 FireFox
- [ ] 💥 Safari
- [ ] mobile (iOS/iPadOS)
- [x] mobile (Android)
- [ ] not applicable
- [ ] other (enter in the "Additional environment details" area below)
Additional environment details
- Android : 15.0
- Phone : Nothing (1)
- Teams Version : 1416/1.0.0.2026023402/0209
- First App tested
- SPFx version : 1.18.2
- Node.js version : 18.20.8
- @pnp/graph: 3.18.0
- @pnp/sp : 3.18.0
- Second App tested
- SPFx version : 1.21.1
- Node.js version : 22.15.0
- @pnp/graph: 4.13.0
- @pnp/sp: 4.13.0
Describe the bug / error
Description
Since the beginning of the year, Microsoft has enhanced the security for authentication of Android base Teams devices MC1088732. With this changes , the authentication/access token expired faster (approximately 1 hour) and is not refresh automatically in SPFx webpart in Teams Personal App on android Mobile.
Because of this, we are unable to call Graph's API with web API permission (User.ReadBasic.All, etc) in SPFx webpart
I have the same issue on all tenants i have access to (more than 4). In all of these tenants, MFA are applied on each tenant.(The API permissions User.ReadBasic.All is also authorized on all tenants)
I tried to log the error using my mobile phone and i got this error :
Error making HttpClient request in queryable [401] ::> {"error":{"code":"InvalidAuthenticationToken","message":"Lifetime validation failed, the token is expired."}}
Other colleges tried on their phones ( Google Pixel,Samsung with Android 16) and they have the same error by reproducing the same step (5 to 7) has describe below.
There is not links with network or organization settings.
I also tried on a second app in 1.21.1 with same error
I also tried with my webpart on a SharePoint Site by using the SharePoint Application on my android device and the Graph's call is working.
Workaround
If i sign-out and sing-in, the token if refresh and the Graph's API call works. But after approximately 1 hour, the access token expired, and the API call fails.
Questions
If it's the intended behavior of the Microsoft Changes MC1088732. Do we simply need to update our Teams App version to 1449 and it's resolved ? Or do we need to implement, in our apps, the refresh the access token ?
Thank you for your feedback !
Steps to reproduce
- Create a SPFx webpart
- Configure webApiPersmissionRequests in package-solution.json
"webApiPermissionRequests": [
{
"resource": "Microsoft Graph",
"scope": "User.ReadBasic.All"
}
]
- Validate webApiPermission for User.ReadBasic.All in SharePoint Admin
- Make a Call using Graph API ( for ex: /me) by using choosing one if these options :
- PnP/Graph
import { Version } from "@microsoft/sp-core-library";
import { IPropertyPaneConfiguration } from "@microsoft/sp-property-pane";
import { BaseClientSideWebPart } from "@microsoft/sp-webpart-base";
import { ITheme, loadTheme } from "@fluentui/react";
import * as React from "react";
import * as ReactDom from "react-dom";
import Context from "../../services/Context";
import App from "./components/App";
import { SPFx as spSPFx } from "@pnp/sp";
import { SPFx as graphSPFx } from "@pnp/graph";
import { graph } from "@pnp/graph";
export default class ContosoAppWebPart extends BaseClientSideWebPart<never> {
public render(): void {
const element: React.ReactElement = React.createElement(App, {
context: this.context,
});
ReactDom.render(element, this.domElement);
}
protected onThemeChanged(theme: ITheme | undefined): void {
if (theme) loadTheme(theme);
}
protected onInit(): Promise<void> {
graph.using(graphSPFx(this.context));
await graph.me();
return super.onInit();
}
protected onDispose(): void {
ReactDom.unmountComponentAtNode(this.domElement);
}
protected get dataVersion(): Version {
return Version.parse("1.0");
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [],
};
}
}
- ServiceScope and the AadHttpClientFactory
- App
import { Version } from "@microsoft/sp-core-library";
import { IPropertyPaneConfiguration } from "@microsoft/sp-property-pane";
import { BaseClientSideWebPart } from "@microsoft/sp-webpart-base";
import { initializeIcons, ITheme, loadTheme } from "@fluentui/react";
import * as React from "react";
import * as ReactDom from "react-dom";
import App from "./components/App";
import { IContosoApp} from "./components/ContosoAppProps";
import { GraphService } from "../../services/GraphService/GraphService";
export default class ContosoAppWebPart extends BaseClientSideWebPart<never> {
private _graphService: GraphService;
public render(): void {
const element: React.ReactElement<IContosoAppProps> = React.createElement(App, {
context: this.context,
clientWidth: this.context.domElement.clientWidth,
graphService: this._graphService
});
ReactDom.render(element, this.domElement);
}
protected onThemeChanged(theme: ITheme | undefined): void {
if (theme) loadTheme(theme);
}
protected async onInit(): Promise<void> {
if (this.context.sdks.microsoftTeams) initializeIcons();
this._graphService = this.context.serviceScope.consume(GraphService.serviceKey);
return super.onInit();
}
protected onDispose(): void {
ReactDom.unmountComponentAtNode(this.domElement);
}
protected get dataVersion(): Version {
return Version.parse("1.0");
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: []
};
}
}```
- ServiceScope
```typescript
import { ServiceKey, ServiceScope } from "@microsoft/sp-core-library";
import { AadHttpClient, AadHttpClientFactory } from "@microsoft/sp-http";
import { IUser } from "../../models/User";
export class GraphService {
private static readonly graphBaseUrl: string = "https://graph.microsoft.com/v1.0";
public static readonly serviceKey: ServiceKey<IGraphService> = ServiceKey.create<IGraphService>(
"Custom:GraphService",
GraphService
);
private _aadHttpClientFactory: AadHttpClientFactory;
constructor(serviceScope: ServiceScope) {
serviceScope.whenFinished(() => {
this._aadHttpClientFactory = serviceScope.consume(AadHttpClientFactory.serviceKey);
});
}
/**
* Fetch the current user.
*/
public async getCurrentUser(): Promise<IUser> {
try {
const aadClient: AadHttpClient = await this._aadHttpClientFactory.getClient(
"https://graph.microsoft.com"
);
const response = await aadClient.get(
`https://graph.microsoft.com/v1.0/me`,
AadHttpClient.configurations.v1
);
if (!response.ok) {
throw new Error(`Error fetching current user: ${response.statusText}`);
}
const user: IUser = await response.json();
return user;
} catch (error) {
console.error("Error in getCurrentUser:", error);
throw error;
}
}
}
export const GraphServiceKey = ServiceKey.create<IGraphService>(
"my-custom.GraphService",
GraphService
);
- Create a Teams Personal App using the SPFx Webpart
- Launch the App on a android mobile.
- Close your Teams and wait +-1 hour until the access token expired.
- Launch the App again
Expected behavior
The webpart will return a error if the access token expired :
Error making HttpClient request in queryable [401] ::> {"error":{"code":"InvalidAuthenticationToken","message":"Lifetime validation failed, the token is expired."}}```
Hello @Hugo-Hanus,
Thank you for bringing this issue to our attention. We will look into it and get back to you shortly.
If you don’t receive a reply within two working days, please use this escalation form to escalate.
@Hugo-Hanus, We were able to repro the issue.
- The behavior you’re seeing (access token expiring after ~1 hour on Android Teams Personal App, requiring sign-in to refresh) aligns with Microsoft’s security enhancements for Teams on Android (MC1088732).
- Access tokens in this scenario do not refresh automatically inside SPFx webparts on Android Teams.
- Graph API calls fail after token expiration with 401 InvalidAuthenticationToken.
- This behavior is specific to Teams on Android; SPFx webparts in SharePoint Online or desktop Teams continue to refresh tokens as expected.
Workarounds / Recommendations:
- Manual sign-out/sign-in temporarily refreshes the token.
- Implement token refresh handling in the SPFx webpart using AadHttpClient or the Teams SDK authentication.authenticate() to handle expired tokens.
Thanks @Hugo-Hanus and @Ashlesha-MSFT on the submission on the issue and also on doing initial investigation on this. This is not good and our engineering team is looking into this one. Hopefully we'll get a conclusion on this within upcoming days. We do understand the importance of fixing this asap and consider this as a bug.
@VesaJuvonen any update on this? i think i'm running into this and its a real problem for us as an educational institution where our students rely on viva connections/teams. All our android users are having this issue where if they log off and log back on it'll work for a little while, but then any future api calls from the cards just fail. which I'm assuming is the exact same issue as we're using the auth token from this to hit our own apis and graph.
After receiving a bug report from one of our customers, we investigated our telemetry across multiple tenants where our application is deployed. We can confirm that we are observing this issue as well.
When filtering our logs for the message "Lifetime validation failed, the token is expired.", we see the following distribution of occurrences per hour over the past three months. The issue first appeared in early December and, after mid-December, has continued to occur consistently.
This error occurs exclusively on Microsoft Teams for Android. We do not see it on iOS devices or any desktop clients.
As the chart illustrates, a significant number of users are impacted. We would greatly appreciate prioritization of this issue. If a full fix is expected to take time, guidance on a temporary mitigation or workaround would also be highly valuable.
Running into this issue as well. We're using a SPFx web part as a SPA/intranet landing page that's also deployed to Teams as a personal app - this._graphClient = await this.context.msGraphClientFactory.getClient("3") followed by calls to various endpoints. Works in the browser (in SharePoint and Teams), works in Teams desktop app, but get the "Lifetime validation failed..." error from the Teams mobile app on Android. As suggested, logging out and back in to the app makes it work again for a short time, but that's not an acceptable workaround.
I have also the same problem : Android Teams app gives same error.
Any updates on this issue? We've developed several ACEs calling different Azure-secured APIs (MS Graph, proprietary APIs, 3rd-party APIs). All of them have stopped working on Android devices due to the same errors mentioned before. Telling hundreds of employees to log-off and log-on on their Android devices to make things working again for 1 hour is quite annoying...
@Ashlesha-MSFT It would be very kind and polite if you responded to our messages, as it's already one month since your last update and we're still facing these issues.
Hi @MarksPoint,
Following up on this — we’ve recently validated that the issue appears to be fixed in newer Android Teams builds.
Specifically, starting from Teams Android 1416/1.0.84.2026061302:
- Expired access tokens are now correctly detected
- Silent refresh is triggered via the NAA broker
- Graph/API calls succeed without requiring re-login
This confirms the fix was applied in the Teams Android native layer, not in SPFx or MSAL.
Could you confirm if you’re still experiencing the issue on the latest Teams version? If yes, sharing the exact build would help.
Thanks for the update! Much appreciated.
Unfortunately we don't have information about the exact Teams for Android version that our end users use. However, we do see a drop in the number of errors since Wednesday last week. It's not completely gone but this could be caused by older versions of Teams Android still being used.
We'll monitor our environment coming weeks to see if the number continues to drop. I'll keep you informed.
Hello, It's seems working, without error.We are now using version 1416/1.0.0.2026044202/0317 on our Android phones.
I checked the version history in the Microsoft documentation Teams App Versioning Mobile:Android. But it isn't up to date, the last entry is 2025 | July 23 | 1416/1.0.0.2025132903.
If no additional feedback is received from other users, this bug will be closed next week.
Thanks to @VesaJuvonen, @Ashlesha-MSFT, and the engineering team for the clarification and support.