Fields not Exported after User Export Job in Go SDK

Problem statement

This article addresses the situation in which Admins cannot get the field (i.e., multifactor_last_modified) after a user export job with the Go SDK.

Symptoms

The returned export file does not include the custom Fields.

Troubleshooting

With the Go SDK, the “Fields” can be added to the Job and updated with the multifactor_last_modified parameter. If nothing is added to it, a set of predefined fields will be exported, as explained here.

Cause

The issue is not related to the Go SDK but to the application. If the management.User struct is used, the multifactor_last_modified property is dropped when calling json.Unmarshal. This is because the management.User struct does not include the multifactor_last_modified property. See this link for more info.

Solution

Okta recommends the following:

  1. Create a custom struct that has all the requesting fields from the export. The below snippet should suffice.
  2. Use ExportedUser instead of management.User in the code.
type ExportedUser struct { Email string `json:"email"` Multifactor []string `json:"multifactor"` MultifactorLastModified string `json:"multifactor_last_modified"` }

Once this is done, the multifactor_last_modified property should be visible in the exported file.