Returns a str, a new "claim-token", which you can use to register your new Plex Server instance to your
            account.
            See: https://hub.docker.com/r/plexinc/pms-docker/, https://www.plex.tv/claim/
350328
def claimToken(self):
        
        response = self._session.get('https://plex.tv/api/claim/token.json', headers=self._headers(), timeout=TIMEOUT)
        if response.status_code not in (200, 201, 204):  # pragma: no cover
            codename = codes.get(response.status_code)[0]
            errtext = response.text.replace('\n', ' ')
            log.warning('BadRequest (%s) %s %s; %s' % (response.status_code, codename, response.url, errtext))
            raise BadRequest('(%s) %s %s; %s' % (response.status_code, codename, response.url, errtext))
        return response.json()['token']
877849
def get_token(self):
        
        if self.token == None:
            self.token = self.authenticate(self.username, self.password)
        try:
            return str(self.token,'utf-8')
        except TypeError:
            return self.token
1186651
def gcommer_claim(address=None):
    
    if not address:
        # get token for any world
        # this is only useful for testing,
        # because that is exactly what m.agar.io does
        url = 'http://at.gcommer.com/status'
        text = urllib.request.urlopen(url).read().decode()
        j = json.loads(text)
        for address, num in j['status'].items():
            if num > 0:
                break  # address is now one of the listed servers with tokens
    url = 'http://at.gcommer.com/claim?server=%s' % address
    text = urllib.request.urlopen(url).read().decode()
    j = json.loads(text)
    token = j['token']
    return address, token
908724
def myPlexAccount(self):
        
        if self._myPlexAccount is None:
            from plexapi.myplex import MyPlexAccount
            self._myPlexAccount = MyPlexAccount(token=self._token)
        return self._myPlexAccount
1256907
function processToken(token, done) {
    var user = _.find(users, function (item) {
        return item.username === token[claims.username];
    });
    if (!user) {
        user = {
            id          : token[claims.id] || currId++,
            username    : token[claims.username],
            email       : token[claims.email],
            firstName   : token[claims.firstName],
            lastName    : token[claims.lastName]
        };
        var roles = token[claims.role];
        if (!roles) {
            roles = ["guest"];
        } else if (!(roles instanceof Array)) {
            roles = [roles];
        }
        user.roles = roles;
        users.push(user);
    }
    done(null, user);
}
34835
def token(cls: Type[CLTVType], timestamp: int) -> CLTVType:
        
        cltv = cls()
        cltv.timestamp = str(timestamp)
        return cltv
1296772
def for_user(cls, user):
        
        user_id = getattr(user, api_settings.USER_ID_FIELD)
        if not isinstance(user_id, int):
            user_id = str(user_id)

        token = cls()
        token[api_settings.USER_ID_CLAIM] = user_id

        return token
450349
def create_token(credential, opts = {})
      data, _status_code, _headers = create_token_with_http_info(credential, opts)
      return data
    end
1195957
def get_token
      return @token if !@token.nil?
      body =  build_auth_json

      http_client = HTTPClient.new

      p @auth_url
      p body
	
      response = http_client.post_content(@auth_url, body, 'Content-Type' => 'application/json')
      response_json_body = JSON.load(response)

      @token = response_json_body['access']['token']['id']
    end
1063476
def GET_account_tokens(self, path_info, account_addr):
        
        if not check_account_address(account_addr):
            return self._reply_json({'error': 'Invalid address'}, status_code=400)

        blockstackd_url = get_blockstackd_url()
        res = blockstackd_client.get_account_tokens(account_addr, hostport=blockstackd_url)
        if json_is_error(res):
            log.error("Failed to load tokens for {}: {}".format(account_addr, res['error']))
            return self._reply_json({'error': 'Failed to load tokens for {}: {}'.format(account_addr, res['error'])}, status_code=res.get('http_status', 500))

        self._reply_json({'tokens': res})
        return
251473
def current_custom_claims():
    
    jwt_data = get_jwt_data_from_app_context()
    return {k: v for (k, v) in jwt_data.items() if k not in RESERVED_CLAIMS}
989567
def claim_exp(self, data):
        
        expiration = getattr(settings, 'OAUTH_ID_TOKEN_EXPIRATION', 30)
        expires = self.now + timedelta(seconds=expiration)
        return timegm(expires.utctimetuple())
41846
def verify(self):
        
        # According to RFC 7519, the "exp" claim is OPTIONAL
        # (https://tools.ietf.org/html/rfc7519#section-4.1.4).  As a more
        # correct behavior for authorization tokens, we require an "exp"
        # claim.  We don't want any zombie tokens walking around.
        self.check_exp()

        # Ensure token id is present
        if api_settings.JTI_CLAIM not in self.payload:
            raise TokenError(_('Token has no id'))

        self.verify_token_type()
682213
def token(cls: Type[XHXType], sha_hash: str) -> XHXType:
        
        xhx = cls()
        xhx.sha_hash = sha_hash
        return xhx
939732
def reset_token(self, **params):
        
        response = self.claim_token(**params)
        if not self.user:
            return response

        self.user.api_key.reset_token()
        headers = remember(self.request, self.user.username)
        return JHTTPOk('Registered', headers=headers)
405759
def add_token_object(self, token):
        '''  '''
        token.sent = self  # take ownership of given token
        self.__tokens.append(token)
        return token
241174
def _get_token_create_url(config):
    '''
    
    '''
    role_name = config.get('role_name', None)
    auth_path = '/v1/auth/token/create'
    base_url = config['url']
    return '/'.join(x.strip('/') for x in (base_url, auth_path, role_name) if x)