Store token to disk be used in later program executions.

@param {Object} token - The token to store to the filesystem.
@returns {void}
181386
function storeToken(token) {
    const file = {
        name: path.join(constants.GLOBAL_DIR, constants.GLOBAL_TOKEN),
        source: JSON.stringify(token),
    };
    createFile(file);
    return;
}
405857
function(token, cb){
      // deserialize the token iss
      var _iss = token.iss.split('|');

      waterlock.User.findOne(_iss[0]).exec(function(err, user){
        if(err){
          waterlock.logger.debug(err);
        }

        cb(err, user);
      });
    }
27919
public void logout( String token ) {
		if( token != null ) {
			this.tokenToLoginTime.remove( token );
			this.tokenToUsername.remove( token );
		}
	}
1117516
function getStoredToken (storageLocation) {
	var token = readCookie(storageLocation);
	if (!token && (window && window.localStorage || window.sessionStorage)) {
		token = window.sessionStorage.getItem(storageLocation) || window.localStorage.getItem(storageLocation);
	}
	return token;
}
1137484
function(token) {
        this.oauthClient.setCredentials(token);
        this.brain.set(this.TOKEN_KEY, token.access_token);
        if (token.refresh_token) {
            this.brain.set(this.REFRESH_KEY, token.refresh_token);
        }
        this.brain.set(this.EXPIRY_KEY, +token.expiry_date);
        this.brain.save();
        this.brain.resetSaveInterval(60);
    }
1361656
function assign (key, token) {
  validator('tokenLabel', key)
  validator('token', token)

  tokens[key] = token
}
1018099
public function saveToken($token)
    {
        $rows = $this->_db->query(
            'UPDATE '.$this->_dbConfig['table']
                        .' SET '.$this->_dbConfig['token'].' = :tk'
                        .' WHERE '.$this->_dbConfig['id'].' = :id',
            [':tk'=>$token, ':id'=>$this->_data['id']]
        );
        if ($rows > 0) {
            $this->_data['token'] = $token;
            return true;
        }
        return false;
    }
165674
function storeToken(credentials, token) {
    fs.writeFile(TOKEN_PATH, JSON.stringify(token));
    console.log('Token stored to ' + TOKEN_PATH);

    console.log('Add the following json block to your .juttle/config.{js,json} file:');
    var juttle_config = {
        adapters: {
            "gmail": {
                "client-credentials": credentials,
                "oauth2-token": token,
            }
        }
    };

    console.log(JSON.stringify(juttle_config, null, 4));

    console.log("If you already have a \"adapters\" section, add the \"gmail\" section under the existing \"adapters\" section.");
}
489059
function setToken(list, token, enabled){
		enabled ? list.add(token) : list.remove(token);
	}
745348
def _save_token_on_disk(self):
        """"""
        token = self._token.copy()

        # Client secret is needed for token refreshing and isn't returned
        # as a pared of OAuth token by default
        token.update(client_secret=self._client_secret)

        with codecs.open(config.TOKEN_FILE_PATH, 'w', 'utf8') as f:
            json.dump(
                token, f,
                ensure_ascii=False,
                sort_keys=True,
                indent=4,
            )
407299
public Optional<String> authenticate(String token) {
    String tokenHash = tokenGenerator.hash(token);
    try (DbSession dbSession = dbClient.openSession(false)) {
      UserTokenDto userToken = dbClient.userTokenDao().selectByTokenHash(dbSession, tokenHash);
      if (userToken == null) {
        return empty();
      }
      userLastConnectionDatesUpdater.updateLastConnectionDateIfNeeded(userToken);
      return of(userToken.getUserUuid());
    }
  }
222183
private static TokenRange tokenRange(Token token) {
        JavaToken javaToken = token.javaToken;
        return new TokenRange(javaToken, javaToken);
    }
100590
function AuthChallengeMessage(token) {
  var _token = token || new Buffer(0);

  Response.call(this, 0x0E);

  Object.defineProperty(this, 'token', {
    set: function(val) { _token = val; },
    get: function() { return _token; }
  });
}
362943
async function loadToken (url) {
  let tokens
  try {
    const data = await readFile(credentialsPath)
    tokens = JSON.parse(data)
  } catch (err) {}
  return tokens && tokens[url]
}
360054
def save_token(self, user, token):
        """"""
        self.config.set('auth', 'user', user)
        self.config.set('auth', 'token', token)
        # allow_no_value=True is used to keep the comments on the config file.
        new_config = ConfigParser(allow_no_value=True)

        # Parse the config file. If no config file was found, then create some
        # default sections on the config variable.
        new_config.read(self.config_file)
        self.check_sections(new_config)

        new_config.set('auth', 'user', user)
        new_config.set('auth', 'token', token)
        filename = os.path.expanduser(self.config_file)
        with open(filename, 'w') as out_file:
            os.chmod(filename, 0o0600)
            new_config.write(out_file)
1332742
async function() {
    const oThis = this
    ;

    await new openSTStorage.TokenBalanceModel({
      ddb_service: ddbServiceObj,
      auto_scaling: autoScalingServiceObj,
      erc20_contract_address: oThis.erc20
    }).allocate();
  }
180930
function hasValidToken (storageLocation) {
	var token = getStoredToken(storageLocation);
	if (token) {
		try {
			var payload = decode(token);
			return payloadIsValid(payload);
		} catch (error) {
			return false;
		}
	}
	return false;
}