getPSTNcall Javascript error

Occasional Visitor

I am able to get acesstoken with all the scope but when I add CallRecord-PstnCalls.Read.All, CallRecords.Read.All to scopes it gives me error

 

msal-browser.min.js:35 Uncaught (in promise) ServerError: invalid_client: AADSTS650053: The application 'postman' asked for scope 'CallRecord-PstnCalls.Read.All' that doesn't exist on the resource '00000003-0000-0000-c000-000000000000'. Contact the app vendor.
Trace ID: f7f4e4a5-078d-4aaf-bee7-c0c61f9f8e00
Correlation ID: 66ccba3c-fce0-4c40-8b00-83060b9defc3
Timestamp: 2021-12-28 13:24:30Z

 

the following is my code.Please help me my boss needs this done today.I have all the permission in azure for PSTN

 

const express = require('express')
const app = express();
const port = 3000;

app.get('/', (req, res) => {
  res.send('Hello World!')
});

app.listen(port, () => {
  console.log(`Example app listening on port ${port}!`)
});
async function run(){

    const config = {
        auth: {
            clientId: '1be18c1a-5a3d-43ac-a953-5e04c6b8a93f',
            authority: 'https://login.microsoftonline.com/organizations/',
            redirectUri: 'http://localhost:8080'
        }
    };
    var client = new msal.PublicClientApplication(config);
    
    var loginRequest = {
        scopes: ['CallRecord-PstnCalls.Read.All','CallRecords.Read.All']
    };
    let loginResponse = await client.loginPopup(loginRequest);
    console.log('Login Response', loginResponse);
    var tokenRequest = {
        scopes: ['https://graph.microsoft.com/.default' ],
        account: loginResponse.account
    };
    let tokenResponse = await client.acquireTokenSilent(tokenRequest);
    console.log('Token Response', tokenResponse);
    let payload = await fetch("https://graph.microsoft.com/v1.0/communications/callRecords/getPstnCalls(fromDateTime=2019-11-01,toDateTime=2019-12-01)", {
        headers: {
            'Authorization': 'Bearer ' + tokenResponse.accessToken
        }
    });
    let json = await payload.json();
    console.log('Graph Response', json);
}

 

 

0 Replies