Update token with new values.

        :param token: The token value.
        :param secret: The secret key.
772509
def update_token(self, token, secret):
        
        if self.access_token != token or self.secret != secret:
            with db.session.begin_nested():
                self.access_token = token
                self.secret = secret
                db.session.add(self)
1216581
def update(self, friendly_name=values.unset):
        
        data = values.of({'FriendlyName': friendly_name, })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return SigningKeyInstance(
            self._version,
            payload,
            account_sid=self._solution['account_sid'],
            sid=self._solution['sid'],
        )
1259959
def generate_hash(data: dict, token: str) -> str:
    
    secret = hashlib.sha256()
    secret.update(token.encode('utf-8'))
    sorted_params = collections.OrderedDict(sorted(data.items()))
    msg = '\n'.join("{}={}".format(k, v) for k, v in sorted_params.items() if k != 'hash')
    return hmac.new(secret.digest(), msg.encode('utf-8'), digestmod=hashlib.sha256).hexdigest()
1106376
def replace_token(self, sid, sinfo, token_type):
        
        try:
            # Mint a new one
            refresh_token = self.handler[token_type](sid, sinfo=sinfo)
        except KeyError:
            pass
        else:
            # blacklist the old is there is one
            try:
                self.handler[token_type].black_list(sinfo[token_type])
            except KeyError:
                pass

            sinfo[token_type] = refresh_token

        return sinfo
448982
def update_refresh_tokens(mrrt)
      fail ArgumentError, 'Token must contain an MRRT.' unless mrrt.mrrt?
      @token_cache.find.each do |entry|
        entry.refresh_token = mrrt.refresh_token if mrrt.can_refresh?(entry)
      end
    end
117374
def update_token(*tokens)
      tokens.map do |token|
        begin
          id = get_id_from_token(token) # As token should be in list
          fail SlackBotManager::InvalidToken if !id || id.empty?

          # Issue reset command
          storage.set(teams_key, id, 'restart')
          true
        rescue => err
          on_error(err)
          false
        end
      end
    end
813923
public function setToken($token, $token_secret = '') {
    $this->getOauthPlugin()->setToken($token, $token_secret);
    $this->getConfig()->set('access_token', $token);
    return $this;
  }
154906
function addJwtHandling(secrets, app) {

  if (!secrets.authTokenSecret) {
    log.error(
      'Cannot setup token authentication because token secret is not configured.'
    );
    return;
  }

  app.use(expressJwt({
    secret: secrets.authTokenSecret
  }));

  app.use(function (req, res, next) {

    if (req.user && req.user.data) {

      req.user.isAuthenticated = true;
      req.user.meta = req.user.meta || {};
    }
    next();
  });
  app.use(function (err, req, res, next) {
    if (err.name === 'UnauthorizedError') {
      if (err.code === 'credentials_required') {
        // If the caller did not provide credentials, we'll just consider this
        // an unauthenticated request.
        next();
      } else {
        res.status(401).send('Invalid token: ' + err.message);
      }
    }
  });
}
350824
def encode_id_token(self, id_token):
        

        # Encode the ID token using the `client_secret`.
        #
        # TODO: Using the `client_secret` is not ideal, since it is transmitted
        # over the wire in some authentication flows.  A better alternative is
        # to use the public key of the issuer, which also allows the ID token to
        # be shared among clients. Doing so however adds some operational
        # costs. We should consider this for the future.

        secret = id_token.access_token.client.client_secret

        return id_token.encode(secret)
711129
def change_token(self, id): # pylint: disable=invalid-name,redefined-builtin
        
        schema = UserSchema(exclude=('password', 'password_confirm'))
        resp = self.service.post(self.base+str(id)+'/token/')
        return self.service.decode(schema, resp)
719295
def refresh_token(self, refresh_token):
        

        response = requests.post('%saccess_token' % OAUTH_URL, {
                                 'refresh_token': refresh_token,
                                 'grant_type': 'refresh_token',
                                 'client_id': self.client_id,
                                 'client_secret': self.client_secret
                                 })
        resp = json.loads(response.content)

        if 'access_token' in resp:
            self.token = resp['access_token']

        return resp
1356637
def new(cls, alias, sealed_obj, algorithm, key, key_size):
        
        timestamp = int(time.time()) * 1000

        raise NotImplementedError("Creating Secret Keys not implemented")
883702
def add(ctx, secret, name, issuer, period, oath_type, digits, touch, algorithm,
        counter, force):
    

    oath_type = OATH_TYPE[oath_type]
    algorithm = ALGO[algorithm]
    digits = int(digits)

    if not secret:
        while True:
            secret = click.prompt('Enter a secret key (base32)', err=True)
            try:
                secret = parse_b32_key(secret)
                break
            except Exception as e:
                click.echo(e)

    ensure_validated(ctx)

    _add_cred(ctx, CredentialData(secret, issuer, name, oath_type, algorithm,
                                  digits, period, counter, touch), force)
560867
def update_token(self):
        
        headers = {
            'Content-Type': 'application/x-www-form-urlencoded',
            'Authorization': 'Basic ' + base64.b64encode(
                (self._key + ':' + self._secret).encode()).decode()
            }
        data = {'grant_type': 'client_credentials'}

        response = requests.post(TOKEN_URL, data=data, headers=headers)
        obj = json.loads(response.content.decode('UTF-8'))
        self._token = obj['access_token']
        self._token_expire_date = (
            datetime.now() +
            timedelta(minutes=self._expiery))
1057337
def refresh_token(self, **kwargs):
        
        if 'client_secret' not in kwargs:
            kwargs.update(client_secret=self.client_secret)
        if 'client_id' not in kwargs:
            kwargs.update(client_id=self.client_id)
        return self.session.refresh_token(token_url, **kwargs)
270116
def update_params(self, token, match):
        """"""
        for k, v in self.params.items():
            if isinstance(v, MatchGroup):
                self.params[k] = v.get_group_value(token, match)
738569
def tokenProgressFunc(state="update", action=None, text=None, tick=0):
	
	print("tokenProgressFunc %s: %s\n%s (%s)"%(state, str(action), str(text), str(tick)))