I am trying to get data from google search console https://www.googleapis.com/webmasters/v3/sites but from Node backend not the front end, I have created OAuth 2.0 Client IDs and API key on the google api console. But I can find the way to connect.
I am following this guide https://googleapis.dev/nodejs/googleapis/latest/searchconsole/index.html
I just want to be able to make read requests from node.
I tried this
import { google } from 'googleapis'
const auth = new google.auth.OAuth2(
YOUR_CLIENT_ID,
YOUR_CLIENT_SECRET,
YOUR_REDIRECT_URL
);
google.options({ auth })
const searchconsole = google.webmasters({ version: 'v3', auth })
const sites = await searchconsole.sites.list({})
console.log(sites)
I get this error even thou all the credentials are correct
'Error: No access, refresh token, API key or refresh handler callback is set.'