Skip to content
This repository was archived by the owner on Nov 18, 2025. It is now read-only.
This repository was archived by the owner on Nov 18, 2025. It is now read-only.

OAUTH Token undefined #35

@bobbbino

Description

@bobbbino

Hi

I'm sure this is my ineptitude that's causing this issue but maybe you can help.

When I call the OpenSidebar() function to authorize the application, the link shown does not have a oauth token defined. Instead of including the token, the URL is as follows:

https://developer.health.nokia.com/account/authorize?oauth_token=undefined

Here is my code (with the consumer keys removed).

function getNokiaService() {
  return OAuth1.createService('nokia')
    .setAccessTokenUrl('https://developer.health.nokia.com/account/access_token')
    .setRequestTokenUrl('https://developer.health.nokia.com/account/request_token')
    .setAuthorizationUrl('https://developer.health.nokia.com/account/authorize')

    .setConsumerKey('')
    .setConsumerSecret('')
    
    .setCallbackFunction('authCallback')
  
    .setPropertyStore(PropertiesService.getUserProperties());
}

function showSidebar() {
  var nokiaService = getNokiaService();
  if (!nokiaService.hasAccess()) {
    var authorizationUrl = nokiaService.authorize();
    var template = HtmlService.createTemplate(
    '<a href="<?= authorizationUrl ?>" target="_blank">Authorize</a>. ' +
    'Reopen the sidebar when the authorization is complete.');
    template.authorizationUrl = authorizationUrl;
    var page = template.evaluate();
    SpreadsheetApp.getUi().showSidebar(page);
  } else {
    
  }
}

function authCallback(request) {
  var nokiaService = getNokiaService();
  var isAuthorized = nokiaService.handleCallback(request);
  if (isAuthorized) {
    return HtmlService.createHtmlOutput('Success! You can close this tab');
  } else {
    return HtmlService.createHtmlOutput('Denied');
  }
}

function syncNokiaData() {
  var nokiaService = getNokiaService();
  var response = nokiaService.fetch('https://api.health.nokia.com/measure?action=getmeas');
  return response;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions