I got the code below to create a user:
const msalConfig = {
auth: {
clientId: "Ive substituted this for my clientId",
redirectUri: "Ive substituted this for my URL",
},
};
const graphScopes = ["user.read", "mail.send"];
const msalApplication = new UserAgentApplication(msalConfig);
const options = new MSALAuthenticationProviderOptions(graphScopes);
const authProvider = new ImplicitMSALAuthenticationProvider(msalApplication, options);
const options2 = {
authProvider,
};
const client = Client.init(options2);
const user = {
accountEnabled: true,
displayName: "Adele Vance",
mailNickname: "AdeleV",
userPrincipalName: "AdeleV[@](/users/na/?userId=a28c79c1-c609-48db-b55f-1783d1187afb).onmicrosoft.com",
"passwordProfile" : {
forceChangePasswordNextSignIn: true,
password: "xWwvJ]6NMw+bWH-d"
}
};
let res = client.api('/users')
.post(user);
})
But I get the following error: tslib.js:113 Uncaught (in promise) TypeError: _this.provider is not a function
Can anybody help me?