Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

206
Visualizações
"TypeError: OAuth2.createService is not a function" when trying to use the OAuth2 library

I tried using the OAuth2 library - https://github.com/googleworkspace/apps-script-oauth2

However, after I set up my variables I keep getting the createservice is not a function error. I get this for all of them methods from the library, as if its not activated. Any tips on what I might be doing wrong? Thanks!

    function getToken() {
  // Create a new service with the given name. The name will be used when
  // persisting the authorized token, so ensure it is unique within the
  // scope of the property store.
  
      const scriptProperties = PropertiesService.getScriptProperties();
  var client_id = scriptProperties.getProperty('CLIENT_ID');
  var secret = scriptProperties.getProperty('SECRET');
  
  
  var service = OAuth2.createService('Service')
  // Set the endpoint URLs, which are the same for all Google services.
  .setAuthorizationBaseUrl('X')
  .setTokenUrl('X')
  
  // Set the client ID and secret, from the Google Developers Console.
  .setClientId(client_id)
  .setClientSecret(secret)
  
  // Set the name of the callback function in the script referenced
  // above that should be invoked to complete the OAuth flow.
  .setCallbackFunction('authCallback')
  
  // Set the property store where authorized tokens should be persisted.
  .setPropertyStore(PropertiesService.getUserProperties())
  
  // Set the scopes to request (space-separated for Google services).
  .setScope('CustomerAPI.Public')
  
  .setParm()
  
  Logger.log(service);
  
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda