I’m working on a Wolfram Language Package to connect into Bigquery (that I’ll make public available). In order to finish It, I need to solve a last step, that is how to get an authentication token using JWT json file.
The package it already working, but with a very ugly part, where I do a call to R Script just to generate the access token to be used in the Google Cloud API.
library(jsonlite) library(httr) authPath <- "/Users/rodrigomurta/Desktop/GetBigQueryToken/bigquery.json" googleEndpoint <- httr::oauth_endpoint( base_url = "https://accounts.google.com/o/oauth2", authorize = "auth", access = "token", validate = "https://www.googleapis.com/oauth2/v1/tokeninfo", revoke = "revoke" ) jsonInfo <- jsonlite::fromJSON(authPath, simplifyVector = FALSE) scope <- c( "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform" ) token <- httr::oauth_service_token(endpoint = googleEndpoint, secrets = jsonInfo, scope = scope) token <- token$credentials$access_token cat(token)
The returned token is something in this format:
I tried to explore
SecuredAuthenticationKey function, but without success. It would be cool to have a 100% Mathematica implementation for both facilitate distribution and make possible to run It inside Wolfram Cloud.
Some clue on how to do that?