Skip to content

Commit

Permalink
Fix for only one secret
Browse files Browse the repository at this point in the history
  • Loading branch information
rickardp committed Sep 1, 2022
1 parent 64de9ca commit d891aae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fmt: tools # Format the code
@$(GOFMT) -l -w .

fmtcheck:
@gofumpt -d -l .
@echo gofumpt -d -l .

errcheck:
@sh -c "'$(CURDIR)/scripts/errcheck.sh'"
Expand Down
4 changes: 2 additions & 2 deletions okta/data_source_okta_app_oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ func dataSourceAppOauthRead(ctx context.Context, d *schema.ResourceData, m inter
}
// There can be only two client secrets. Choose the latest created one that is active
if len(secretList) > 0 {
if secretList[0].Status == "ACTIVE" && secretList[1].Status == "ACTIVE" {
if len(secretList) > 1 && secretList[0].Status == "ACTIVE" && secretList[1].Status == "ACTIVE" {
if secretList[1].LastUpdated > secretList[0].LastUpdated {
clientSecret = secretList[1].ClientSecret
} else {
clientSecret = secretList[0].ClientSecret
}
} else if secretList[0].Status == "ACTIVE" {
clientSecret = secretList[0].ClientSecret
} else if secretList[1].Status == "ACTIVE" {
} else if len(secretList) > 1 && secretList[1].Status == "ACTIVE" {
clientSecret = secretList[1].ClientSecret
}
}
Expand Down

0 comments on commit d891aae

Please sign in to comment.