A cloud-based identity and access management service for securing user authentication and resource access
Token request cannot be made without authorization code or refresh token when I add "teamsAppInstallation.ReadWriteSelfForChat.All" scope
Hello everyone,
I'm currently facing an issue with the MSAL Node.js authentication library (msal2.js). When attempting to integrate the 'teamsAppInstallation.ReadWriteSelfForChat.All' scope into the Auth-Code flow for a Node.js application, I'm encountering the following error:
ClientAuthError: request_cannot_be_made: Token request cannot be made without authorization code or refresh token.
I'm utilizing the Authorization Code sample provided in the MSAL Node.js library, with the only modification being the addition of the aforementioned scope to my configuration. Below, I've shared the relevant segment of my customConfig.json and the primary code snippet where the error surfaces.
Custom Configuration (customConfig.json):
{
"authOptions": {
"clientId": "XXXXX",
"authority": "https://login.microsoftonline.com/organizations/"
},
"request": {
"authCodeUrlParameters": {
"scopes": ["user.read", "user.read.all", "teamsAppInstallation.ReadWriteSelfForChat.All"],
"redirectUri": "http://localhost:3000/redirect"
},
"tokenRequest": {
"redirectUri": "http://localhost:3000/redirect",
"scopes": ["user.read", "user.read.all", "teamsAppInstallation.ReadWriteSelfForChat.All"]
}
},
"resourceApi": {
"endpoint": "https://graph.microsoft.com/v1.0/me"
}
}
// Relevant express setup and MSAL initialization code
// ...
app.get("/redirect", (req, res) => {
const tokenRequest = {
...requestConfig.tokenRequest,
code: req.query.code,
state: req.query.state,
};
// Additional code for handling the token request
// ...
});
My auth configuration on Azure Entra Admin Center:
I would greatly appreciate any insights or guidance on resolving this error. Is there an additional configuration step or permission that I'm potentially missing for this specific scope?
Thank you for your assistance!
Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
An API that connects multiple Microsoft services, enabling data access and automation across platforms
Microsoft Teams | Microsoft Teams for business | Other
Additional features, settings, or issues not covered by specific Microsoft Teams categories