0

I'm using App ID and I follow this tuts https://cloud.ibm.com/docs/services/appid?topic=appid-tutorial-roles for my personal project.

I tried to call API {{APPID_MANAGEMENT_SERVER_HOST}}/management/v4/{{APPID_TENANT_ID}}/users with body:

  "idp": "cloud_directory",
  "idp-identity": "huynhdn@gmail.com",
  "profile": {
    "attributes": {
      "role": "MANAGER"
    }
  }
}

I get Future User in User Profiles! => OK

Next, I call {{APPID_MANAGEMENT_SERVER_HOST}}/management/v4/{{APPID_TENANT_ID}}/cloud_directory/Users to set password for this user.

  "displayName": "Test User",
  "password": "abcd1234",
  "emails": [
    {
      "value": "huynhdn@gmail.com",
      "primary": true
    }
  ]
}

Finally, I call {{APPID_AUTH_SERVER_HOST}}/oauth/v4/{{APPID_TENANT_ID}}/token to get token with user created above! But when i check in app id, attribute "role" is gone :(

WHY? or Anyone can help me another way to create user has "username", "password", "attribute" with API management!

1 Answers1

0

The doc page you're referencing above states that in order to get future user attribute the user must validate ownership over email. You can either do it through standard means, or manually specifying status:confirmed when creating your CLoud Dir user, e.g.

{
  "displayName": "John Smith",
  "password": "p4ssw0rd",
  "emails": [
    {
      "value": "john@example.com",
      "primary": true
    }
  ],
  "status":"CONFIRMED"
}```
Anton
  • 3,166
  • 1
  • 13
  • 12