Open m0jimo opened 3 years ago
I ran into the same problem and overcome it by making a my own post
request, in my case by using the Axios library.
I needed to check if a user was a member of a group and achieved this using the onToken
callback parameter.
Below is a simplified example
Vue.use(msal,
{
auth: {
authority: `https://login.microsoftonline.com/${process.env.VUE_APP_AZURE_ACTIVE_DIRECTORY_TENANT_ID}`,
clientId: process.env.VUE_APP_AZURE_STORE_CLIENT_APPLICATION_ID,
redirectUri: `${window.location.origin}/login`,
onToken: (ctx) => {
const groupIds = {groupIds: []}//Group Id's retrieved from config
axios.post(`https://graph.microsoft.com/v1.0/directoryObjects/${ctx.account.accountIdentifier}/checkMemberGroups`,
{ groupIds },
{ headers: {
authorization: `bearer ${ctx.data.accessToken}`,
"access-control-allow-methods": "[POST]",
Accept: "application/json",
"Content-Type": "application/json"
}
}).then(response => {
const groups = response.data.value;
//Add the groups to the user stored in Vuex
});
}
}
})
$msal
works great for me with Graph connections to get data from Sharepoint.But is there a way how to send a Graph
post
request or at least to use client for Graph post and update request?Thanks.
Actually you can add the configurations in your request .Like this:
$msal.msGraph({url:'https://graph.microsoft.com/v1.0/me/events',method:'POST',data:getters.getItem})
I use Vuex store here ,dont be confused
$msal
works great for me with Graph connections to get data from Sharepoint.But is there a way how to send a Graph
post
request or at least to use client for Graph post and update request?Thanks.