Google-api-nodejs-client: Method to get a new access token?

Created on 15 May 2020  路  1Comment  路  Source: googleapis/google-api-nodejs-client

Hello,
Is there any other method that i am able to trigger to get a new access token except "on" event? I need to get the access token manually because i am very confused on how "on" event works and tell you the truth, it never triggered and no tokens coming from "on" event! Anyway, wondering is there manually method i can use to get the token?

Most helpful comment

I am closing this because I solved it by doing it with http post (may help someone):

const request = require('request')
request.post(
  'https://www.googleapis.com/oauth2/v4/token',
  {
      json: {
          "client_id"     : '',
          "client_secret" : '',
          "refresh_token" : '',
          "grant_type"    : 'refresh_token'
      }
  },
  (error, res, body) => {
      console.log(body)
  }
)

>All comments

I am closing this because I solved it by doing it with http post (may help someone):

const request = require('request')
request.post(
  'https://www.googleapis.com/oauth2/v4/token',
  {
      json: {
          "client_id"     : '',
          "client_secret" : '',
          "refresh_token" : '',
          "grant_type"    : 'refresh_token'
      }
  },
  (error, res, body) => {
      console.log(body)
  }
)
Was this page helpful?
0 / 5 - 0 ratings