Skip to content

Commit

Permalink
feat: fixes setting of authentication realm url. (#1537)
Browse files Browse the repository at this point in the history
* fixes setting of authentication realm url.

* removes changes to go.* files.
  • Loading branch information
marcosuma authored Oct 20, 2023
1 parent ff55b45 commit 5f0cb4a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mongodbatlas/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net/http"
"net/url"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
"github.com/mongodb-forks/digest"
Expand Down Expand Up @@ -97,10 +98,12 @@ func (c *MongoDBClient) GetRealmClient(ctx context.Context) (*realm.Client, erro
}

optsRealm := []realm.ClientOpt{realm.SetUserAgent(userAgent)}
authConfig := realmAuth.NewConfig(nil)
if c.Config.BaseURL != "" && c.Config.RealmBaseURL != "" {
optsRealm = append(optsRealm, realm.SetBaseURL(c.Config.RealmBaseURL))
authConfig.AuthURL, _ = url.Parse(c.Config.RealmBaseURL + "api/admin/v3.0/auth/providers/mongodb-cloud/login")
}
authConfig := realmAuth.NewConfig(nil)

token, err := authConfig.NewTokenFromCredentials(ctx, c.Config.PublicKey, c.Config.PrivateKey)
if err != nil {
return nil, err
Expand Down

0 comments on commit 5f0cb4a

Please sign in to comment.