okta / okta-sdk-golang

A Golang SDK for interacting with the Okta management API, enabling server-side code to manage Okta users, groups, applications, and more.
https://github.com/okta/okta-sdk-golang
Other
177 stars 143 forks source link

Bug: Wrong type for `AppUser.Profile` in v4.0.0 #447

Closed erezrokah closed 4 months ago

erezrokah commented 6 months ago

Describe the bug?

I believe the Profile type should be map[string]interface{} instead map[string]map[string]interface{}, see of https://github.com/okta/okta-sdk-golang/blob/v4.0.0/okta/model_app_user.go#L46

As a result JSON decoding of AppUser fails with cannot unmarshal string into Go struct field _AppUser.profile of type map[string]interface {}

What is expected to happen?

Listing application users should succeed

What is the actual behavior?

Listing application users fails

Reproduction Steps?

Use the ListApplicationUsersExecute API

Additional Information?

Example response from the API can be seen in https://developer.okta.com/docs/reference/api/apps/#response-example-32

Golang Version

go version go1.22.1 darwin/arm64

SDK Version

v4.0.0

OS version

Darwin ****-MBP-2 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64

erezrokah commented 6 months ago

Could be related: https://github.com/OpenAPITools/openapi-generator/issues/15281 https://github.com/OpenAPITools/openapi-generator/issues/15582

duytiennguyen-okta commented 6 months ago

OKTA internal reference https://oktainc.atlassian.net/browse/OKTA-716406

duytiennguyen-okta commented 6 months ago

@erezrokah Do you have the response that causes the error? for both AppUser.Profile and ApplicationGroupAssignment.Profile

erezrokah commented 6 months ago

Thanks for the quick response @duytiennguyen-okta, there's an example response in https://github.com/cloudquery/cloudquery/issues/16836#issuecomment-2037535304 for ApplicationGroupAssignment.Profile but I was able to reproduce for AppUser.Profile

erezrokah commented 6 months ago

Example response from the API can be seen in https://developer.okta.com/docs/reference/api/apps/#response-example-32

The response I got looks like the one in the REST API docs, copying the one from the docs so the issue has all the information:

[
  {
    "id": "00ui2sVIFZNCNKFFNBPM",
    "externalId": "005o0000000umnEAAQ",
    "created": "2014-08-15T18:59:43.000Z",
    "lastUpdated": "2014-08-15T18:59:48.000Z",
    "scope": "USER",
    "status": "PROVISIONED",
    "statusChanged": "2014-08-15T18:59:48.000Z",
    "passwordChanged": null,
    "syncState": "SYNCHRONIZED",
    "lastSync": "2014-08-15T18:59:48.000Z",
    "credentials": {
      "userName": "user@example.com"
    },
    "profile": {
      "secondEmail": null,
      "lastName": "McJanky",
      "mobilePhone": "415-555-555",
      "email": "user@example.com",
      "salesforceGroups": [],
      "role": "CEO",
      "firstName": "Karl",
      "profile": "Standard Platform User"
    },
    "_links": {
      "app": {
        "href": "https://{yourOktaDomain}/api/v1/apps/0oajiqIRNXPPJBNZMGYL"
      },
      "user": {
        "href": "https://{yourOktaDomain}/api/v1/users/00ui2sVIFZNCNKFFNBPM"
      }
    }
  },
  {
    "id": "00ujsgVNDRESKKXERBUJ",
    "externalId": "005o0000000uqJaAAI",
    "created": "2014-08-16T02:35:14.000Z",
    "lastUpdated": "2014-08-16T02:56:49.000Z",
    "scope": "USER",
    "status": "PROVISIONED",
    "statusChanged": "2014-08-16T02:56:49.000Z",
    "passwordChanged": null,
    "syncState": "SYNCHRONIZED",
    "lastSync": "2014-08-16T02:56:49.000Z",
    "credentials": {
      "userName": "saml.jackson@example.com"
    },
    "profile": {
      "secondEmail": null,
      "lastName": "Jackson",
      "mobilePhone": null,
      "email": "saml.jackson@example.com",
      "salesforceGroups": [
        "Employee"
      ],
      "role": "Developer",
      "firstName": "Saml",
      "profile": "Standard User"
    },
    "_links": {
      "app": {
        "href": "https://{yourOktaDomain}/api/v1/apps/0oajiqIRNXPPJBNZMGYL"
      },
      "user": {
        "href": "https://{yourOktaDomain}/api/v1/users/00ujsgVNDRESKKXERBUJ"
      }
    }
  }
]
duytiennguyen-okta commented 6 months ago

@erezrokah

  1. Please censored all the sensitive info.
  2. I am trying to resolve the issue at the root. Please wait a few days for a updated release
erezrokah commented 6 months ago

Thanks! No sensitive info the response it is copied from your docs

github-actions[bot] commented 5 months ago

This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the stale label.

erezrokah commented 5 months ago

Not stale

github-actions[bot] commented 5 months ago

This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the stale label.

erezrokah commented 5 months ago

Not stale