I’m trying to use a M2M access token to register a device credential for a user using the following request.
POST /device-credentials? HTTP/1.1
Host: https://xxxxxxx/api/v2
Authorization: Bearer xxxxxxxxxxxxxxxxxxx
Content-Type: application/json
{
"device_name": "Test Device",
"type": "public_key",
"value": "xxxxxxxxxxxxxx",
"device_id": "test_device",
"client_id": "test"
}
But I get the response
{
"statusCode": 403,
"error": "Forbidden",
"message": "Insufficient scope, expected any of: create:current_user_device_credentials",
"errorCode": "insufficient_scope"
}
I can’t assign create:current_user_device_credentials
to M2M application. I don’t understand how the management api can be used to register a device credential under a specific user because in the above request, I don’t see a way to specify a user id.
Then I created a test application and a user in our application with create:current_user_device_credentials
scope and tried the above request with that user’s access token retrieved using “realm” flow. Then I get the error “Bad audience”.
Also, can you please fix the documentation. Clearly, it’s a copy-paste error. The description for POST is exactly the same as for GET.