SPFx solution as Teams Tab (in native client) with Graph : Cannot read property 'indexOf' of undefined
Category
- [x] Question
- [ ] Typo
- [x] Bug
- [ ] Additional article idea
Expected or Desired Behavior
I deployed an SPFx WebPart using Microsoft Graph that is suppose to be used in both SharePoint and Microsoft Teams tab. It simply get e-mails and files from OneDrive of the current user.
Observed Behavior
In SharePoint and Teams web client, it works just fine. In the Teams desktop application on Windows, I get the following error: Cannot read property 'indexOf' of undefined
Teams Web:

Teams Desktop:

Using fiddler, I only see these errors :
3ed
{"odata.error":{"code":"10001","message":{"lang":"en-US","value":"AADSTS65001: The user or administrator has not consented to use the application with ID '00000003-0000-0ff1-ce00-000000000000' named 'Office 365 SharePoint Online'. Send an interactive authorization request for this user and resource.\r\nTrace ID: 2a8135d9-4523-4d74-8e02-61c23aef9600\r\nCorrelation ID: 9103db9e-b005-0000-69f2-481dc3f57c4f\r\nTimestamp: 2019-05-09 19:22:42Z"},"error.redirectUrl":"https://pvxlab.sharepoint.com/sites/MyTeam/_layouts/15/teamshostedapp.aspx?
Steps to Reproduce
Create an SPFx application and configure to be usable as Teams tab as detailed in the official documentation
Test the tab from the Teams desktop application
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Hey @ypcode can you please check the steps provided in issue #2521 to see if those apply to you as well here?
Hi @lucabandMSFT,
I just performed these steps. It still doesn't work but, as it is highlighted by some folks, there might be a quite long delay before it is actually taken into account. I'll retry later today and keep you informed. I'm sorry I opened this new thread, I did not find that other one with the keywords I thought about.
If you want, we can close this one in keep tracking in #2521 :)
Thanks for your help !
Hi @lucabandMSFT,
I Retried this just now and still have the same issue.
Regards, Yannick
@ypcode , do you mind sharing here the updated manifest? also, to be 100% sure, you did visit the "manage API" page in SP Tenant admin after you modified the manifest in AAD, right?
thanks!
Hi @lucabandMSFT
Here is the manifest
{
"id": "f7f1a3b0-f7e8-44d3-8fd5-6ac25ffaded2",
"acceptMappedClaims": null,
"accessTokenAcceptedVersion": null,
"addIns": [],
"allowPublicClient": null,
"appId": "ef1fe865-9873-4464-8f77-cbf4b2034506",
"appRoles": [],
"oauth2AllowUrlPathMatching": false,
"createdDateTime": "2019-05-07T20:03:23Z",
"groupMembershipClaims": null,
"identifierUris": [
"https://microsoft.spfx3rdparty.com"
],
"informationalUrls": {
"termsOfService": null,
"support": null,
"privacy": null,
"marketing": null
},
"keyCredentials": [],
"knownClientApplications": [],
"logoUrl": null,
"logoutUrl": null,
"name": "SharePoint Online Client Extensibility Web Application Principal",
"oauth2AllowIdTokenImplicitFlow": true,
"oauth2AllowImplicitFlow": true,
"oauth2Permissions": [
{
"adminConsentDescription": "Allow the application to access SharePoint Online Client Extensibility Web Application Principal on behalf of the signed-in user.",
"adminConsentDisplayName": "Access SharePoint Online Client Extensibility Web Application Principal",
"id": "f9bbf4ce-9c5d-4b55-80c2-41ab58bcd2b3",
"isEnabled": true,
"lang": null,
"origin": "Application",
"type": "User",
"userConsentDescription": "Allow the application to access SharePoint Online Client Extensibility Web Application Principal on your behalf.",
"userConsentDisplayName": "Access SharePoint Online Client Extensibility Web Application Principal",
"value": "user_impersonation"
}
],
"oauth2RequirePostResponse": false,
"optionalClaims": null,
"orgRestrictions": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [],
"preAuthorizedApplications": [
{
"appId": "00000003-0000-0ff1-ce00-000000000000",
"permissionIds": [
"f9bbf4ce-9c5d-4b55-80c2-41ab58bcd2b3"
]
}
],
"publisherDomain": "pvxlab.onmicrosoft.com",
"replyUrlsWithType": [
{
"url": "https://pvxlab.sharepoint.com/",
"type": "Web"
},
{
"url": "https://pvxlab.sharepoint.com/_forms/spfxsinglesignon.aspx",
"type": "Web"
}
],
"requiredResourceAccess": [
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "465a38f9-76ea-45b9-9f34-9e8b0d4b0b42",
"type": "Scope"
},
{
"id": "5c28f0bf-8a70-41f1-8ab2-9032436ddb65",
"type": "Scope"
},
{
"id": "570282fd-fa5c-430d-a7fd-fc8dc98a9dca",
"type": "Scope"
},
{
"id": "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
"type": "Scope"
}
]
}
],
"samlMetadataUrl": null,
"signInUrl": null,
"signInAudience": "AzureADMyOrg",
"tags": [],
"tokenEncryptionKeyId": null
}
And yes I visited the "API Management" page and clicked "approve" on all the duplicate pending permissions requests (and got the error saying the permission already exists)
Hey @lucabandMSFT - I see the same on one of tenants
Under the hood here is the error I'm getting:
https://tenant.sharepoint.com/sites/site/_api/Microsoft.SharePoint.Internal.ClientSideComponent.Token.AcquireOBOToken?resource=%27https://graph.microsoft.com%27&clientId=%27cedaab2d-4888-401c-ac89-ff40ae75e31a%27
---
{"odata.error":{"code":"-1, System.AggregateException","message":{"lang":"en-US","value":"One or more errors occurred."}}}
And another tenant doesn't have SharePoint Online Client Extensibility Web Application Principal app at all in Azure AD.
This issue happened to me, also. I just can't get anything from Graph on Teams Desktop environment (web app works fine). I also get "Cannot read property 'indexOf' of undefined".
As far I could go, it seems to be something related with getting an access token.
@AJIXuMuK : for the tenant that doens't have the app at all in AAD: can you please check this https://github.com/SharePoint/sp-dev-docs/issues/3891#issuecomment-494868401? @Barba76 , you confirm that everything works on the web, yes? if that's the case can you please tell me if you have a client secret in the "SPO Client Extensibility Web App Principal" (Dashboard App registrations SharePoint Online Client Extensibility Web Application Principal - Certificates & secrets)?
@lucabandMSFT : Yes, everything works as expected on the web app. I've checked on Azure portal and I don't have any client secrets or certificates.
@Barba76, thanks. Your tenant is an unfortuante but known issue that we are patching this week. @lahuey FYI. Hope we are able to release a fix during next week.
Hi @lucabandMSFT
I am experiencing the same issue initially described by @ypcode:
I'm using an SPFx Solution as Teams Tab with MS Graph. The solution works in the web version of Teams, but the Desktop version returns the same: Cannot read property 'indexOf' of undefined. Additionally, using Fiddler, we receive the same error as @ypcode.
Has anyone been able to get this scenario to work?
Is it an issue that is affecting certain Tenants and not others?
I understand this is currently being worked on, with the hope of releasing a fix this week. Is the fix still aimed at releasing soon, or is it likely to require several more weeks?
Thanks in advance for your help with these questions.
not working for me yet. This time I am getting another error: "Cannot read property 'match' of undefined"
Hi,
This is also not working for me yet. The original error has been replaced with the following: "Unexpected token u in JSON at position 0".
Has anyone gotten this to work?
@joselarios Now, I am getting exactly the same error as you
Same for me, multiple tenants.
Same for me....asked on Twitter too :)
Few details.
In Desktop client there is a GET request to https://tenant/sites/site/_api/Microsoft.SharePoint.Internal.ClientSideComponent.Token.AcquireOBOToken?resource=%27https://graph.microsoft.com%27&clientId=%27some-client-id%27
It returns:
{"odata.metadata":"https://tenant.sharepoint.com/sites/site/_api/$metadata#Edm.Null","odata.null":true}
Which is probably not expected. And actual request is not sent afterwards.
Client id from the request is the client id of SharePoint Online Client Extensibility Web Application Principal registered in the AD