Javascript Conditional Access policy in microsoft graps?

Asked

Viewed 14 times

0

I’m using this tutorial https://docs.microsoft.com/pt-br/graph/tutorials/javascript I managed to make everything run smoothly but i need to make my work a js script that just create a simple room in microsoft graphs

then I created this function

async function createNewMeeting() {
  const user = JSON.parse(sessionStorage.getItem('graphUser'));


  // Build the JSON payload of the event
  let newEvent = {
    "startDateTime": Date.UTC(2021, 02, 2, 10, 01, 0),
    //"endDateTime":"2019-07-12T15:00:34.2464912-07:00",
    "subject":"User Token Meeting"
  };

  try {
    // POST the JSON to the /me/events endpoint
    console.log(await graphClient
      .api('/me/onlineMeetings')
      .post(newEvent));

    // Return to the calendar view
    getEvents();
  } catch (error) {
    updatePage(Views.error, {
      message: 'Error creating event',
      debug: error
    });
  }
}

And a button in the UI just to create this Meeting and would be perfect.

My config (you can see I tried a lot)

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

// <msalConfigSnippet>
const msalConfig = {
  auth: {
    clientId: '6bfbcbcf-9822-4c55-a4be-1815679066a7',
    redirectUri: 'http://localhost:8080',
    //claims: [access_token:}
    //client_secret: '7-0~~~1PwdS_s91M-Wto33m2KW6F-AjekI'
    //AuthProvider: MyAuthenticationProvider
    //authority: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
  }
};

const msalRequest = {
  scopes: [
    'user.read',
    'mailboxsettings.read',
    'calendars.readwrite',
    'OnlineMeetings.Read',
    'OnlineMeetings.ReadWrite'
  ]
}

but I can’t make it work, says I need a Conditional Access policy but I can’t find an example anywhere how to implement this, to have the documentation telling me what it’s for I found about 500 places (rsrs) I wanted to test this, the other things were... Obs I bought up 'Microsoft Office 365' so I could try using this.

The mistake that comes when I try to create is this:

{ "statusCode": 400, "code": "AuthenticationError", "requestId": "cf1e0096-93cd-4293-b950-d6efce0bba12", "date": "2021-02-02T16:38:45.000Z", "body": "{\"code\":\"AuthenticationError\",\"message\":\"Error authenticating with resource\",\"innerError\":{\"date\":\"2021-02-02T13:38:45\",\"request-id\":\"cf1e0096-93cd-4293-b950-d6efce0bba12\",\"client-request-id\":\"fd0003b1-dba3-80d7-68b0-f50e36c59b62\"}}" }
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.