Skip to content

Commit

Permalink
use organization from config when DiableOkta flag is active
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaras-nobl9 committed Sep 13, 2023
1 parent c3f53a8 commit 66f3b94
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sdk/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ func (c *credentials) GetEnvironment(ctx context.Context) (string, error) {
// as it is extracted from the token claims.
// credentials.organization should no tbe accessed directly, but rather through this method.
func (c *credentials) GetOrganization(ctx context.Context) (string, error) {
if c.config.DisableOkta {
return c.config.Organization, nil
}

if _, err := c.refreshAccessToken(ctx); err != nil {
return "", errors.Wrap(err, "failed to get organization")
}
Expand Down Expand Up @@ -150,10 +154,6 @@ func (c *credentials) setAuthorizationHeader(r *http.Request) {
// If the token was not yet set, it will request a new one all the same.
func (c *credentials) refreshAccessToken(ctx context.Context) (updated bool, err error) {
if c.config.DisableOkta {
c.organization = c.config.Organization
if c.organization == "" {
return false, errors.New("organization is not set")
}
return false, nil
}
if !c.shouldRefresh() {
Expand Down

0 comments on commit 66f3b94

Please sign in to comment.