Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use github token if present when fetching org id #19244

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion builtin/credential/github/path_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ func (b *backend) pathConfigWrite(ctx context.Context, req *logical.Request, dat
}

if c.OrganizationID == 0 {
client, err := b.Client("")
var githubToken string
if token, ok := data.GetOk("token"); ok {
if t, ok := token.(string); ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add token to the framework.FieldSchema above in pathConfig(). You can see an example of that here. If we do that then we can safely do the type assertion without this "if ok" pattern. Additionally, we will want to add token to the API docs.

githubToken = t
}
}
client, err := b.Client(githubToken)
if err != nil {
return nil, err
}
Expand Down