### Get Preview Sign-In Page Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/CustomPagesAPI.md Retrieves the preview of the sign-in page for a given brand. Ensure the Okta SDK for Go is imported and configured. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { brandId := "brandId_example" // string | The ID of the brand configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.CustomPagesAPI.GetPreviewSignInPage(context.Background(), brandId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `CustomPagesAPI.GetPreviewSignInPage``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetPreviewSignInPage`: SignInPage fmt.Fprintf(os.Stdout, "Response from `CustomPagesAPI.GetPreviewSignInPage`: %v\n", resp) } ``` -------------------------------- ### Get Sign-In Page Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/CustomPagesAPI.md Retrieves the sign-in page sub-resources for a specified brand, with an option to expand additional metadata. Requires the Okta SDK for Go. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { brandId := "brandId_example" // string | The ID of the brand expand := []string{"Expand_example"} // []string | Specifies additional metadata to be included in the response (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.CustomPagesAPI.GetSignInPage(context.Background(), brandId).Expand(expand).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `CustomPagesAPI.GetSignInPage``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetSignInPage`: PageRoot fmt.Fprintf(os.Stdout, "Response from `CustomPagesAPI.GetSignInPage`: %v\n", resp) } ``` -------------------------------- ### Get Authenticator Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/AuthenticatorAPI.md Use this to retrieve details of a specific authenticator. You need to provide the authenticator ID. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { authenticatorId := "aut1nd8PQhGcQtSxB0g4" // string | `id` of the authenticator configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.AuthenticatorAPI.GetAuthenticator(context.Background(), authenticatorId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `AuthenticatorAPI.GetAuthenticator``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetAuthenticator`: AuthenticatorBase fmt.Fprintf(os.Stdout, "Response from `AuthenticatorAPI.GetAuthenticator`: %v\n", resp) } ``` -------------------------------- ### Okta Client Base Configuration Example Source: https://github.com/okta/okta-sdk-golang/blob/master/README.md Demonstrates setting up the Okta client with common base configuration options. Ensure these values align with your Okta environment and security policies. ```go config, err := okta.NewConfiguration( okta.WithConnectionTimeout(60), okta.WithCache(true), okta.WithCacheTtl(300), okta.WithCacheTti(300), okta.WithUserAgentExtra(""), okta.WithTestingDisableHttpsCheck(false), okta.WithRequestTimeout(0), okta.WithRateLimitMaxBackOff(30), okta.WithRateLimitMaxRetries(2), okta.WithAuthorizationMode("SSWS"), ) if err != nil { fmt.Printf("Error: %v\n", err) } client := okta.NewAPIClient(config) ``` -------------------------------- ### Get Log Stream Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/LogStreamAPI.md Retrieves details for a specific log stream. Requires the log stream ID. ```go package main import ( "context" "fmt" "os" openapiClient "github.com/okta/okta-sdk-golang" ) func main() { logStreamId := "0oa1orzg0CHSgPcjZ0g4" // string | Unique identifier for the log stream configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.LogStreamAPI.GetLogStream(context.Background(), logStreamId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `LogStreamAPI.GetLogStream``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetLogStream`: ListLogStreams200ResponseInner fmt.Fprintf(os.Stdout, "Response from `LogStreamAPI.GetLogStream`: %v\n", resp) } ``` -------------------------------- ### List Sign-In Widget Versions Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/CustomPagesAPI.md Lists all available versions of the Sign-In Widget for a specified brand. This is useful for managing widget updates. ```go package main import ( "context" "fmt" "os" openapi client "github.com/okta/okta-sdk-golang" ) func main() { brandId := "brandId_example" // string | The ID of the brand configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.CustomPagesAPI.ListAllSignInWidgetVersions(context.Background(), brandId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `CustomPagesAPI.ListAllSignInWidgetVersions``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListAllSignInWidgetVersions`: []string fmt.Fprintf(os.Stdout, "Response from `CustomPagesAPI.ListAllSignInWidgetVersions`: %v\n", resp) } ``` -------------------------------- ### CreateUISchema Property Management Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/CreateUISchema.md Provides examples of how to get, set, and check for the presence of the UiSchema property within a CreateUISchema object. ```APIDOC ## CreateUISchema Property Management ### GetUiSchema `func (o *CreateUISchema) GetUiSchema() UISchemaObject` GetUiSchema returns the UiSchema field if non-nil, zero value otherwise. ### GetUiSchemaOk `func (o *CreateUISchema) GetUiSchemaOk() (*UISchemaObject, bool)` GetUiSchemaOk returns a tuple with the UiSchema field if it's non-nil, zero value otherwise, and a boolean to check if the value has been set. ### SetUiSchema `func (o *CreateUISchema) SetUiSchema(v UISchemaObject)` SetUiSchema sets the UiSchema field to the given value. ### HasUiSchema `func (o *CreateUISchema) HasUiSchema() bool` HasUiSchema returns a boolean indicating if a field has been set. ``` -------------------------------- ### Instantiate API Client (v4+) Source: https://github.com/okta/okta-sdk-golang/blob/master/MIGRATING.md Example of how to instantiate individual API clients using a configuration object in v4 and later. ```go config, err := okta.NewConfiguration( okta.WithOrgUrl("https://{yourOktaDomain}"), okta.WithToken("{apiToken}"), ) if err != nil { return nil, err } client = okta.NewAPIClient(config) user, resp, err := client.UserAPI.GetUser(apiClient.cfg.Context, "{UserId|Username|Email}").Execute() if err != nil { fmt.Printf("Error Getting User: %v\n", err) } fmt.Printf("User: %+v\n Response: %+v\n\n",user, resp) ``` -------------------------------- ### Get Realm Assignment Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/RealmAssignmentAPI.md Retrieves a specific realm assignment using its ID. Ensure the `assignmentId` is correctly set. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { assignmentId := "rul2jy7jLUlnO3ng00g4" // string | ID of the realm assignment configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.RealmAssignmentAPI.GetRealmAssignment(context.Background(), assignmentId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RealmAssignmentAPI.GetRealmAssignment``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetRealmAssignment`: RealmAssignment fmt.Fprintf(os.Stdout, "Response from `RealmAssignmentAPI.GetRealmAssignment`: %v\n", resp) } ``` -------------------------------- ### List Okta Support Cases Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/OrgSettingSupportAPI.md Demonstrates how to list Okta support cases using the Okta SDK for Go. Ensure you have initialized the API client with your configuration. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrgSettingSupportAPI.ListOktaSupportCases(context.Background()).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrgSettingSupportAPI.ListOktaSupportCases``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListOktaSupportCases`: OktaSupportCases fmt.Fprintf(os.Stdout, "Response from `OrgSettingSupportAPI.ListOktaSupportCases`: %v\n", resp) } ``` -------------------------------- ### Get Push Provider Go SDK Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/PushProviderAPI.md Retrieves a specific push provider by its ID. Ensure the pushProviderId is correctly set. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { pushProviderId := "pushProviderId_example" // string | Id of the push provider configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.PushProviderAPI.GetPushProvider(context.Background(), pushProviderId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `PushProviderAPI.GetPushProvider``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetPushProvider`: ListPushProviders200ResponseInner fmt.Fprintf(os.Stdout, "Response from `PushProviderAPI.GetPushProvider`: %v\n", resp) } ``` -------------------------------- ### List Supported Security Questions Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/UserFactorAPI.md Lists all supported security questions for a given Okta user. Ensure the Okta SDK for Go is imported and configured. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { userId := "00ub0oNGTSWTBKOLGLNR" // string | ID of an existing Okta user configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.UserFactorAPI.ListSupportedSecurityQuestions(context.Background(), userId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `UserFactorAPI.ListSupportedSecurityQuestions``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListSupportedSecurityQuestions`: []UserFactorSecurityQuestionProfile fmt.Fprintf(os.Stdout, "Response from `UserFactorAPI.ListSupportedSecurityQuestions`: %v\n", resp) } ``` -------------------------------- ### Go: Get Email Settings Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/CustomTemplatesAPI.md Retrieves the email settings for a specific brand and template. Ensure you have the Okta SDK for Go installed and configured. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { brandId := "brandId_example" // string | The ID of the brand templateName := "templateName_example" // string | The name of the email template configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.CustomTemplatesAPI.GetEmailSettings(context.Background(), brandId, templateName).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `CustomTemplatesAPI.GetEmailSettings``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetEmailSettings`: EmailSettingsResponse fmt.Fprintf(os.Stdout, "Response from `CustomTemplatesAPI.GetEmailSettings`: %v\n", resp) } ``` -------------------------------- ### Instantiate OktaClient (v2) Source: https://github.com/okta/okta-sdk-golang/blob/master/MIGRATING.md Example of how to instantiate the global OktaClient in versions prior to v6. ```go ctx, client, err := okta.NewClient( context.TODO(), okta.WithOrgUrl("https://{yourOktaDomain}"), okta.WithToken("{apiToken}"), ) if err != nil { fmt.Printf("Error: %v\n", err) } user, resp, err := client.User.GetUser(ctx, "{UserId|Username|Email}") if err != nil { fmt.Printf("Error Getting User: %v\n", err) } fmt.Printf("User: %+v\n Response: %+v\n\n",user, resp) ``` -------------------------------- ### SetupInstructionsUri Methods Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/ApiService.md Methods for getting, setting, and checking the SetupInstructionsUri property. ```APIDOC ## SetupInstructionsUri Methods ### GetSetupInstructionsUri `func (o *ApiService) GetSetupInstructionsUri() string` GetSetupInstructionsUri returns the SetupInstructionsUri field if non-nil, zero value otherwise. ### GetSetupInstructionsUriOk `func (o *ApiService) GetSetupInstructionsUriOk() (*string, bool)` GetSetupInstructionsUriOk returns a tuple with the SetupInstructionsUri field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetSetupInstructionsUri `func (o *ApiService) SetSetupInstructionsUri(v string)` SetSetupInstructionsUri sets SetupInstructionsUri field to given value. ### HasSetupInstructionsUri `func (o *ApiService) HasSetupInstructionsUri() bool` HasSetupInstructionsUri returns a boolean if a field has been set. ``` -------------------------------- ### Get Identity Source Group Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/IdentitySourceAPI.md Retrieves details of a specific group within an identity source. This example shows how to use the Okta SDK for Go to fetch group information using either the Okta group ID or its external ID. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { identitySourceId := "0oa3l6l6WK6h0R0QW0g4" // string | The ID of the identity source for which the session is created groupOrExternalId := "00gsl4xM9ys8TdnbZ0g4 or GROUPEXT123456784C2IF" // string | The Okta group ID or external ID of the identity source group configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.IdentitySourceAPI.GetIdentitySourceGroup(context.Background(), identitySourceId, groupOrExternalId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `IdentitySourceAPI.GetIdentitySourceGroup``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetIdentitySourceGroup`: GroupsResponseSchema fmt.Fprintf(os.Stdout, "Response from `IdentitySourceAPI.GetIdentitySourceGroup`: %v\n", resp) } ``` -------------------------------- ### Get Trusted Origin Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/TrustedOriginAPI.md Retrieve details of a specific trusted origin using this Go code. The trusted origin ID is required. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { trustedOriginId := "7j2PkU1nyNIDe26ZNufR" // string | `id` of the trusted origin configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.TrustedOriginAPI.GetTrustedOrigin(context.Background(), trustedOriginId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `TrustedOriginAPI.GetTrustedOrigin``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetTrustedOrigin`: TrustedOrigin fmt.Fprintf(os.Stdout, "Response from `TrustedOriginAPI.GetTrustedOrigin`: %v\n", resp) } ``` -------------------------------- ### List Realm Assignments Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/RealmAssignmentAPI.md Demonstrates how to list realm assignments using the Okta SDK for Go. Includes pagination parameters like limit and after. Ensure the SDK is imported and configured. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { limit := int32(56) // int32 | A limit on the number of objects to return (optional) (default to 20) after := "after_example" // string | The cursor used for pagination. It represents the priority of the last realm assignment returned in the previous fetch operation. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.RealmAssignmentAPI.ListRealmAssignments(context.Background()).Limit(limit).After(after).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RealmAssignmentAPI.ListRealmAssignments``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListRealmAssignments`: []RealmAssignment fmt.Fprintf(os.Stdout, "Response from `RealmAssignmentAPI.ListRealmAssignments`: %v\n", resp) } ``` -------------------------------- ### Get Federated Claim Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/ApplicationSSOFederatedClaimsAPI.md Retrieve a specific federated claim for an Okta application. Ensure you have the correct application ID and claim ID. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { appId := "0oafxqCAJWWGELFTYASJ" // string | Application ID claimId := "ofc2f4zrZbs8nUa7p0g4" // string | The unique `id` of the federated claim configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.ApplicationSSOFederatedClaimsAPI.GetFederatedClaim(context.Background(), appId, claimId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ApplicationSSOFederatedClaimsAPI.GetFederatedClaim``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetFederatedClaim`: FederatedClaimRequestBody fmt.Fprintf(os.Stdout, "Response from `ApplicationSSOFederatedClaimsAPI.GetFederatedClaim`: %v\n", resp) } ``` -------------------------------- ### List Supported User Factors Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/UserFactorAPI.md Lists all supported factors for a given Okta user. This requires the Okta SDK for Go to be set up. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { userId := "00ub0oNGTSWTBKOLGLNR" // string | ID of an existing Okta user configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.UserFactorAPI.ListSupportedFactors(context.Background(), userId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `UserFactorAPI.ListSupportedFactors``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListSupportedFactors`: []UserFactorSupported fmt.Fprintf(os.Stdout, "Response from `UserFactorAPI.ListSupportedFactors`: %v\n", resp) } ``` -------------------------------- ### Get Feature for Application Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/ApplicationFeaturesAPI.md Use this snippet to retrieve a specific feature for a given application. Ensure you have the application ID and feature name. ```go package main import ( "context" "fmt" "os" openapi client "github.com/okta/okta-sdk-golang" ) func main() { appId := "0oafxqCAJWWGELFTYASJ" // string | Application ID featureName := "featureName_example" // string | Name of the Feature configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.ApplicationFeaturesAPI.GetFeatureForApplication(context.Background(), appId, featureName).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ApplicationFeaturesAPI.GetFeatureForApplication``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetFeatureForApplication`: ListFeaturesForApplication200ResponseInner fmt.Fprintf(os.Stdout, "Response from `ApplicationFeaturesAPI.GetFeatureForApplication`: %v\n", resp) } ``` -------------------------------- ### List Applications with Various Parameters Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/ApplicationAPI.md Demonstrates how to list Okta applications using the `ListApplications` function with a comprehensive set of optional parameters. This includes searching by name/label, pagination, optimization, VPN settings, filtering, expanding user data, and including non-deleted applications. Ensure you have the Okta SDK for Go configured. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { q := "Okta" // string | Searches for apps with `name` or `label` properties that starts with the `q` value using the `startsWith` operation (optional) after := "16278919418571" // string | Specifies the [pagination](/#pagination) cursor for the next page of results. Treat this as an opaque value obtained through the `next` link relationship. (optional) useOptimization := true // bool | Specifies whether to use query optimization. If you specify `useOptimization=true` in the request query, the response contains a subset of app instance properties. (optional) (default to false) alwaysIncludeVpnSettings := true // bool | Specifies whether to include the VPN configuration for existing notifications in the result, regardless of whether VPN notifications are configured (optional) (default to false) limit := int32(56) // int32 | Specifies the number of results per page (optional) (default to -1) filter := "status%20eq%20%22ACTIVE%22" // string | Filters apps with a supported expression for a subset of properties. Filtering supports the following limited number of properties: `id`, `status`, `credentials.signing.kid`, `settings.slo.enabled`, or `name`. See [Filter](https://developer.okta.com/docs/api/#filter). (optional) expand := "user/0oa1gjh63g214q0Hq0g4" // string | An optional parameter used for link expansion to embed more resources in the response. Only supports `expand=user/{userId}` and must be used with the `user.id eq "{userId}"` filter query for the same user. Returns the assigned [application user](/openapi/okta-management/management/tags/applicationusers) in the `_embedded` property. (optional) includeNonDeleted := true // bool | Specifies whether to include non-active, but not deleted apps in the results (optional) (default to false) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.ApplicationAPI.ListApplications(context.Background()).Q(q).After(after).UseOptimization(useOptimization).AlwaysIncludeVpnSettings(alwaysIncludeVpnSettings).Limit(limit).Filter(filter).Expand(expand).IncludeNonDeleted(includeNonDeleted).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ApplicationAPI.ListApplications``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListApplications`: []ListApplications200ResponseInner fmt.Fprintf(os.Stdout, "Response from `ApplicationAPI.ListApplications`: %v\n", resp) } ``` -------------------------------- ### Get Linked Object Definition Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/LinkedObjectAPI.md Retrieves a specific linked object definition by its name. Ensure the `linkedObjectName` variable is set to the correct value. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { linkedObjectName := "linkedObjectName_example" // string | Primary or Associated name configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.LinkedObjectAPI.GetLinkedObjectDefinition(context.Background(), linkedObjectName).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `LinkedObjectAPI.GetLinkedObjectDefinition``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetLinkedObjectDefinition`: LinkedObject fmt.Fprintf(os.Stdout, "Response from `LinkedObjectAPI.GetLinkedObjectDefinition`: %v\n", resp) } ``` -------------------------------- ### GetSetupInstructionsUriOk Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/Scim.md Retrieves the SetupInstructionsUri. It returns the URI if set, and a boolean indicating if the value was present. ```APIDOC ## GetSetupInstructionsUriOk ### Description GetSetupInstructionsUriOk returns a tuple with the SetupInstructionsUri field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### Method func (o *Scim) GetSetupInstructionsUriOk() (*string, bool) ``` -------------------------------- ### Get Identity Provider Go Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/IdentityProviderAPI.md Retrieve details of a specific Identity Provider (IdP) using its ID. This Go example shows how to fetch IdP information. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { idpId := "0oa62bfdjnK55Z5x80h7" // string | `id` of IdP configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.IdentityProviderAPI.GetIdentityProvider(context.Background(), idpId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `IdentityProviderAPI.GetIdentityProvider``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetIdentityProvider`: IdentityProvider fmt.Fprintf(os.Stdout, "Response from `IdentityProviderAPI.GetIdentityProvider`: %v\n", resp) } ``` -------------------------------- ### Get Sign-Out Page Settings Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/CustomPagesAPI.md Retrieves the current sign-out page settings for a given brand. Ensure the brand ID is correctly specified. ```go package main import ( "context" "fmt" "os" openapi client "github.com/okta/okta-sdk-golang" ) func main() { brandId := "brandId_example" // string | The ID of the brand configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.CustomPagesAPI.GetSignOutPageSettings(context.Background(), brandId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `CustomPagesAPI.GetSignOutPageSettings``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetSignOutPageSettings`: HostedPage fmt.Fprintf(os.Stdout, "Response from `CustomPagesAPI.GetSignOutPageSettings`: %v\n", resp) } ``` -------------------------------- ### Create a User with Okta SDK for Go Source: https://github.com/okta/okta-sdk-golang/blob/master/README.md Demonstrates how to create a new user in Okta, including setting their credentials and profile information. Ensure you have your Okta domain and API token configured. ```go import ( "fmt" "context" "github.com/okta/okta-sdk-golang/v6/okta" ) func main() { config, err := okta.NewConfiguration( okta.WithOrgUrl("https://{yourOktaDomain}"), okta.WithToken("{apiToken}"), ) if err != nil { fmt.Printf("Error: %v\n", err) } client := okta.NewAPIClient(config) password := &okta.PasswordCredential{ Value: "Abcd1234!", } userCredentials := &okta.UserCredentials{ Password: password, } profile := okta.UserProfile{} profile["firstName"] = "Ben" profile["lastName"] = "Solo" profile["email"] = "ben-solo@example.com" profile["login"] = "ben-solo@example.com" createUserRequest := okta.CreateUserRequest{ Credentials: userCredentials, Profile: &profile, } users, resp, err := client.UserAPI.CreateUser(context.Background()).Body(createUserRequest).Activate(true).Execute() if err != nil { fmt.Printf("Error Creating Users: %v\n", err) } fmt.Printf("User: %+v\n Response: %+v\n\n", user, resp) } ``` -------------------------------- ### List Authorization Server Policies Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/AuthorizationServerPoliciesAPI.md Lists all policies for a given authorization server. Requires the authorization server ID. Handles potential errors and prints the response. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { authServerId := "GeGRTEr7f3yu2n7grw22" // string | `id` of the Authorization Server configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.AuthorizationServerPoliciesAPI.ListAuthorizationServerPolicies(context.Background(), authServerId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `AuthorizationServerPoliciesAPI.ListAuthorizationServerPolicies``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListAuthorizationServerPolicies`: []AuthorizationServerPolicy fmt.Fprintf(os.Stdout, "Response from `AuthorizationServerPoliciesAPI.ListAuthorizationServerPolicies`: %v\n", resp) } ``` -------------------------------- ### Initialize Okta Client (v5 vs v6) Source: https://github.com/okta/okta-sdk-golang/blob/master/MIGRATING.md Client initialization is simplified in v6. v5 uses NewClient with context and options, while v6 uses NewConfiguration and NewAPIClient. ```go ctx, client, err := okta.NewClient( context.TODO(), okta.WithOrgUrl("https://dev-123456.okta.com"), okta.WithToken("your-api-token"), ) ``` ```go config := okta.NewConfiguration( okta.WithOrgUrl("https://dev-123456.okta.com"), okta.WithToken("your-api-token"), ) client := okta.NewAPIClient(config) ``` -------------------------------- ### Get User Classification Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/UserClassificationAPI.md Use this snippet to retrieve a specific user's classification. Ensure you have the Okta SDK for Go configured and the user ID is valid. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { userId := "00ub0oNGTSWTBKOLGLNR" // string | ID of an existing Okta user configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.UserClassificationAPI.GetUserClassification(context.Background(), userId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `UserClassificationAPI.GetUserClassification``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetUserClassification`: UserClassification fmt.Fprintf(os.Stdout, "Response from `UserClassificationAPI.GetUserClassification`: %v\n", resp) } ``` -------------------------------- ### Instantiate SlackApplication with Label, Name, and Settings Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/SlackApplication.md Use this constructor to create a new SlackApplication object. It requires the application's label, name, and settings. Default values are assigned to optional properties. ```go func NewSlackApplication(label string, name string, settings SlackApplicationSettings, ) *SlackApplication ``` -------------------------------- ### Get Group Push Mapping Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/GroupPushMappingAPI.md Retrieves a specific group push mapping by its application ID and mapping ID. Ensure you have the Okta SDK for Go configured. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { appId := "0oafxqCAJWWGELFTYASJ" // string | Application ID mappingId := "gPm00000000000000000" // string | Group push mapping ID configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.GroupPushMappingAPI.GetGroupPushMapping(context.Background(), appId, mappingId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `GroupPushMappingAPI.GetGroupPushMapping``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetGroupPushMapping`: GroupPushMapping fmt.Fprintf(os.Stdout, "Response from `GroupPushMappingAPI.GetGroupPushMapping`: %v\n", resp) } ``` -------------------------------- ### List Authorization Server Policy Rules Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/AuthorizationServerRulesAPI.md Demonstrates how to list all policy rules for a given authorization server and policy ID using the Okta Go SDK. Ensure you have the necessary IDs for the authorization server and policy. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { authServerId := "GeGRTEr7f3yu2n7grw22" // string | `id` of the Authorization Server policyId := "00plrilJ7jZ66Gn0X0g3" // string | `id` of the policy configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.AuthorizationServerRulesAPI.ListAuthorizationServerPolicyRules(context.Background(), authServerId, policyId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `AuthorizationServerRulesAPI.ListAuthorizationServerPolicyRules``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListAuthorizationServerPolicyRules`: []AuthorizationServerPolicyRule fmt.Fprintf(os.Stdout, "Response from `AuthorizationServerRulesAPI.ListAuthorizationServerPolicyRules`: %v\n", resp) } ``` -------------------------------- ### Get OAuth2 Claim Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/AuthorizationServerClaimsAPI.md Retrieves a specific custom token claim from an Okta Authorization Server. Ensure you have the correct Authorization Server ID and Claim ID. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { authServerId := "GeGRTEr7f3yu2n7grw22" // string | `id` of the Authorization Server claimId := "hNJ3Uk76xLagWkGx5W3N" // string | `id` of Claim configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.AuthorizationServerClaimsAPI.GetOAuth2Claim(context.Background(), authServerId, claimId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `AuthorizationServerClaimsAPI.GetOAuth2Claim``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetOAuth2Claim`: OAuth2Claim fmt.Fprintf(os.Stdout, "Response from `AuthorizationServerClaimsAPI.GetOAuth2Claim`: %v\n", resp) } ``` -------------------------------- ### List Assigned Applications for a Group using Go SDK Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/GroupAPI.md This example demonstrates how to list all applications assigned to a specific group. Optional parameters like `after` for pagination and `limit` for the number of results per page can be used. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { groupId := "00g1emaKYZTWRYYRRTSK" // string | The `id` of the group after := "after_example" // string | Specifies the pagination cursor for the next page of apps (optional) limit := int32(56) // int32 | Specifies the number of app results for a page (optional) (default to 20) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.GroupAPI.ListAssignedApplicationsForGroup(context.Background(), groupId).After(after).Limit(limit).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `GroupAPI.ListAssignedApplicationsForGroup``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListAssignedApplicationsForGroup`: []ListApplications200ResponseInner fmt.Fprintf(os.Stdout, "Response from `GroupAPI.ListAssignedApplicationsForGroup`: %v\n", resp) } ``` -------------------------------- ### Get Auto Assign Admin App Setting Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/OrgSettingAdminAPI.md Retrieve the Okta Admin Console assignment setting using the Okta SDK for Go. This operation does not require any parameters. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OrgSettingAdminAPI.GetAutoAssignAdminAppSetting(context.Background()).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OrgSettingAdminAPI.GetAutoAssignAdminAppSetting``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetAutoAssignAdminAppSetting`: AutoAssignAdminAppSetting fmt.Fprintf(os.Stdout, "Response from `OrgSettingAdminAPI.GetAutoAssignAdminAppSetting`: %v\n", resp) } ``` -------------------------------- ### List All Features in Go Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/FeatureAPI.md This Go code example demonstrates how to fetch a list of all available features in your Okta organization. It requires the Okta SDK for Go. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.FeatureAPI.ListFeatures(context.Background()).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `FeatureAPI.ListFeatures``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListFeatures`: []Feature fmt.Fprintf(os.Stdout, "Response from `FeatureAPI.ListFeatures`: %v\n", resp) } ``` -------------------------------- ### Clone and Set Up Local Repository Source: https://github.com/okta/okta-sdk-golang/blob/master/CONTRIBUTING.md Clone the Okta Golang SDK repository and set up your local environment with an upstream remote for the official project. ```bash git clone https://github.com/YOUR_ACCOUNT/okta-sdk-golang.git $ cd okta-sdk-golang $ git remote add upstream https://github.com/okta/okta-sdk-golang.git $ git checkout master $ git fetch upstream $ git rebase upstream/master ``` -------------------------------- ### Get Email Domain Go SDK Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/EmailDomainAPI.md Retrieves a specific email domain by its ID. Use this to fetch details of a single email domain, optionally expanding related resources. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { emailDomainId := "emailDomainId_example" // string | expand := []string{"Expand_example"} // []string | Specifies additional metadata to be included in the response (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.EmailDomainAPI.GetEmailDomain(context.Background(), emailDomainId).Expand(expand).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `EmailDomainAPI.GetEmailDomain``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetEmailDomain`: EmailDomainResponseWithEmbedded fmt.Fprintf(os.Stdout, "Response from `EmailDomainAPI.GetEmailDomain`: %v\n", resp) } ``` -------------------------------- ### Get Authorization Server Policy Go Example Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/AuthorizationServerPoliciesAPI.md Retrieves a specific authorization server policy using its ID. Requires the authorization server ID and the policy ID. Handles potential errors and prints the response. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { authServerId := "GeGRTEr7f3yu2n7grw22" // string | `id` of the Authorization Server policyId := "00plrilJ7jZ66Gn0X0g3" // string | `id` of the policy configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.AuthorizationServerPoliciesAPI.GetAuthorizationServerPolicy(context.Background(), authServerId, policyId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `AuthorizationServerPoliciesAPI.GetAuthorizationServerPolicy``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `GetAuthorizationServerPolicy`: AuthorizationServerPolicy fmt.Fprintf(os.Stdout, "Response from `AuthorizationServerPoliciesAPI.GetAuthorizationServerPolicy`: %v\n", resp) } ``` -------------------------------- ### List All Profile Mappings with Optional Parameters Source: https://github.com/okta/okta-sdk-golang/blob/master/okta/docs/ProfileMappingAPI.md This Go example demonstrates how to list all profile mappings in your Okta organization. You can optionally filter and paginate the results using parameters like `after`, `limit`, `sourceId`, and `targetId`. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/okta/okta-sdk-golang" ) func main() { after := "after_example" // string | Mapping `id` that specifies the pagination cursor for the next page of mappings (optional) limit := int32(56) // int32 | Specifies the number of results per page (optional) (default to 20) sourceId := "sourceId_example" // string | The user type or app instance ID that acts as the source of expressions in a mapping. If this parameter is included, all returned mappings have this as their `source.id`. (optional) targetId := "targetId_example" // string | The user type or app instance ID that acts as the target of expressions in a mapping. If this parameter is included, all returned mappings have this as their `target.id`. (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.ProfileMappingAPI.ListProfileMappings(context.Background()).After(after).Limit(limit).SourceId(sourceId).TargetId(targetId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ProfileMappingAPI.ListProfileMappings``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `ListProfileMappings`: []ListProfileMappings fmt.Fprintf(os.Stdout, "Response from `ProfileMappingAPI.ListProfileMappings`: %v\n", resp) } ```