Skip to content

Commit 03b2885

Browse files
out_stackdriver: Ensure URL encoding for the OAuth2 request, and send to the more modern endpoint. (#3198)
Signed-off-by: Igor Peshansky <[email protected]>
1 parent 5550487 commit 03b2885

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

plugins/out_stackdriver/stackdriver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ static int get_oauth2_token(struct flb_stackdriver *ctx)
292292

293293
ret = flb_oauth2_payload_append(ctx->o,
294294
"grant_type", -1,
295-
"urn:ietf:params:oauth:"
296-
"grant-type:jwt-bearer", -1);
295+
"urn%3Aietf%3Aparams%3Aoauth%3A"
296+
"grant-type%3Ajwt-bearer", -1);
297297
if (ret == -1) {
298298
flb_plg_error(ctx->ins, "error appending oauth2 params");
299299
flb_sds_destroy(sig_data);

plugins/out_stackdriver/stackdriver.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@
3434
#define FLB_STD_SCOPE "https://www.googleapis.com/auth/logging.write"
3535

3636
/* Stackdriver authorization URL */
37-
#define FLB_STD_AUTH_URL "https://www.googleapis.com/oauth2/v4/token"
37+
#define FLB_STD_AUTH_URL "https://oauth2.googleapis.com/token"
3838

3939
/* Stackdriver Logging 'write' end-point */
4040
#define FLB_STD_WRITE_URI "/v2/entries:write"
41-
#define FLB_STD_WRITE_URL \
42-
"https://logging.googleapis.com" FLB_STD_WRITE_URI
41+
#define FLB_STD_WRITE_URL "https://logging.googleapis.com" FLB_STD_WRITE_URI
4342

4443
/* Timestamp format */
4544
#define FLB_STD_TIME_FMT "%Y-%m-%dT%H:%M:%S"

0 commit comments

Comments
 (0)