Skip to content

Unable to fetch PolicyRules for MFA_ENROLL policies #509

@outofjungle

Description

@outofjungle

Describe the bug?

Unable fetch all the policy rules for MFA_ENROLL policies, the API call success, however the returned object is empty.

What is expected to happen?

The returned object should contain MFA_ENROLL policy rule data.

What is the actual behavior?

The returned object does not have MFA_ENROLL policy data. There returned data does not have required information.

[
  {
    AccessPolicyRule:<nil> 
    AuthorizationServerPolicyRule:<nil> 
    ContinuousAccessPolicyRule:<nil> 
    EntityRiskPolicyRule:<nil> 
    IdpDiscoveryPolicyRule:<nil> 
    OktaSignOnPolicyRule:<nil> 
    PasswordPolicyRule:<nil> 
    ProfileEnrollmentPolicyRule:<nil>
  }
]

Reproduction Steps?

The following code should produce the issue.

package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/okta/okta-sdk-golang/v5/okta"
)

func main() {
	scopes := []string{
		"okta.policies.read",
	}

	config, err := okta.NewConfiguration(...)
	if err != nil {
		log.Fatal(err)
	}

	client := okta.NewAPIClient(config)

	req := client.PolicyAPI.ListPolicies(context.Background()).Type_("MFA_ENROLL")
	items, _, err := client.PolicyAPI.ListPoliciesExecute(req)
	if err != nil {
		log.Fatal(err)
	}

	for _, p := range items {
		req := client.PolicyAPI.ListPolicyRules(context.Background(), p.MultifactorEnrollmentPolicy.GetId())
		items, _, err := client.PolicyAPI.ListPolicyRulesExecute(req)

		if err != nil {
			log.Fatal(err)
		}
		fmt.Printf("%+v\n", items)
	}
}

Additional Information?

No response

Golang Version

go version go1.23.5 darwin/arm64

SDK Version

github.com/okta/okta-sdk-golang/v5 v5.0.2

OS version

Darwin HOSTNAME 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:23:36 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T8112 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions