I\'m trying to communicate with my app\'s enabled BigQuery API via the server to server method.
I\'ve ticked all the boxes on this Google guide for constructing my J
Be sure to use DateTime.UtcNow instead of DateTime.Now in the GetExpiryAndIssueDate method.
Looks like my guess in the comment above was correct. I got your code working by changing:
"urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer"
to:
"urn:ietf:params:oauth:grant-type:jwt-bearer"
Looks like you were accidentally double-encoding it.
I now get a response which looks something like:
{
"access_token" : "1/_5pUwJZs9a545HSeXXXXXuNGITp1XtHhZXXxxyyaacqkbc",
"token_type" : "Bearer",
"expires_in" : 3600
}
Edited Note: please make sure to have the correct date/time/timezone/dst configuration on your server. Having the clock off by even a few seconds will result in an invalid_grant
error. http://www.time.gov will give the official time from the US govt, including in UTC.