I have implemented an oauth2 flow in my frontend and I am storing user credentials in my backend, like this:
export type Credentials = {
refresh_token: string;
expiry_date: number;
access_token: string;
token_type: string;
id_token: string;
scope: string;
}
I want to connect to BQ on behalf of the user but there is no way to plugin in Oauth2 credentials, only a service account apparently.
This doesn’t work despite being suggested in some places:
import { BigQuery } from "@google-cloud/bigquery";
const bigquery = new BigQuery({
credentials: { access_token: accessToken },
});
The idea is that the user can connect to multiple projects, not just one, so I don’t want to create a SA for each project. Just like when you access the BQ interface, you don’t have a SA per project.
Am I missing something?
Thanks!