Skip to content

Commit

Permalink
fixed token auth
Browse files Browse the repository at this point in the history
  • Loading branch information
archiewood committed Oct 24, 2024
1 parent 58bce3b commit e9226e2
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/gsheets_auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,13 @@ namespace duckdb
}

// TODO: Maybe this should be a KeyValueSecret
static unique_ptr<BaseSecret> CreateGsheetSecretFromAccessToken(ClientContext &context, CreateSecretInput &input)
{
static unique_ptr<BaseSecret> CreateGsheetSecretFromAccessToken(ClientContext &context, CreateSecretInput &input) {
auto scope = input.scope;

auto result = make_uniq<KeyValueSecret>(scope, input.type, input.provider, input.name);

std::string token;
if (input.options.find("use_oauth") != input.options.end() && input.options["use_oauth"] == "true")
{
// Initiate OAuth flow
token = InitiateOAuthFlow();
}
else
{
// Use the provided token
CopySecret("token", input, *result);
}

result->secret_map["token"] = token;
// Manage specific secret option
CopySecret("token", input, *result);

// Redact sensible keys
RedactCommonKeys(*result);
Expand Down

0 comments on commit e9226e2

Please sign in to comment.