php-connect-rest-sample icon indicating copy to clipboard operation
php-connect-rest-sample copied to clipboard

Unable to create User

Open DanyMariaLee opened this issue 9 years ago • 4 comments

@jamescro Hi! I'm trying to create User with POST request to the MS Graph.
And the response is always:

{ "error": { "code": "UnknownError", "message": "{\"Status\":500,\"Message\":\"All the offeractions povided in the property bag cannot be validated for the token.\\u000d\\u000a\"}", "innerError": { "request-id": "566c5644-5a6c-4e99-9ed9-f0052abf18a3", "date": "2017-05-12T07:55:22" } } }

This is the response from MS Graph explorer. I'm sendind the Authorization header with code (which works for getting calendar data for example), the example of request body (with content-type json) is taken from the MS Graph explorer { "accountEnabled": true, "city": "Seattle", "country": "United States", "department": "Sales & Marketing", "displayName": "Melissa Darrow", "givenName": "Melissa", "jobTitle": "Marketing Director", "mailNickname": "MelissaD", "passwordPolicies": "DisablePasswordExpiration", "passwordProfile": { "password": "Test1234", "forceChangePasswordNextSignIn": false }, "officeLocation": "131/1105", "postalCode": "98052", "preferredLanguage": "en-US", "state": "WA", "streetAddress": "9256 Towne Center Dr., Suite 400", "surname": "Darrow", "mobilePhone": "+1 206 555 0110", "usageLocation": "US", "userPrincipalName": "[email protected]" }

Please, help(

DanyMariaLee avatar May 12 '17 08:05 DanyMariaLee

It looks like your client doesn't have sufficient permission to create a user. What permission scopes are you passing when the user authenticates? If you want to create a user, you need to request the User.ReadWrite.All permission scope. Only administrators can consent to that scope, so if you add it to your authentication request, non-admins won't be able to authenticate.

jamescro avatar May 15 '17 16:05 jamescro

That is exactly that I have in scope. All permissions from the docs on MS page. Maybe some mail server problems can cause that problems? I added an MX settings for my domain in Active directory on Azure, should be fine

DanyMariaLee avatar May 15 '17 16:05 DanyMariaLee

Have you posted this question to Stack Overflow? It sounds like your issue is outside the scope of this sample.

jamescro avatar May 15 '17 16:05 jamescro

Closing for now since this doesn't appear to be an issue with the sample.

jamescro avatar May 18 '17 20:05 jamescro