Returns the user's authentication token.
424666
def get_auth_token(self):
        """"""
        data = [str(self.id), hash_data(self.password)]
        return _security.remember_token_serializer.dumps(data)
361810
def get_oauth_token():
    """"""
    url = "{0}/token".format(DEFAULT_ORIGIN["Origin"])
    r = s.get(url=url)
    return r.json()["t"]
1295711
def _getToken(self):
        
        headers = {'Authorization':'GoogleLogin auth=%s' % self.auth_token}
        req = requests.get(ReaderUrl.API_URL + 'token', headers=headers)
        if req.status_code != 200:
            raise IOError("Error getting the Reader token.")
        return req.content
533038
def get_auth_bearer(self):
        """"""
        access_token = ''
        auth_header = self.get_header('authorization')
        if auth_header:
            m = re.search(r"^Bearer\s+(\S+)$", auth_header, re.I)
            if m: access_token = m.group(1)

        return access_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
736333
def access_token(self):
        
        access_token = self.session.get(self.access_token_key)
        if access_token:
            if not self.expires_at:
                # user provided access_token, just return it
                return access_token

            timestamp = time.time()
            if self.expires_at - timestamp > 60:
                return access_token

        self.fetch_access_token()
        return self.session.get(self.access_token_key)
489628
def get_username(self):
        """"""
        _from = self.auth_context['from']
        if self.token_version == 1:
            return '{0}'.format(_from)
        elif self.token_version == 2:
            _user_type = self.auth_context['user_type']
            return '{0}/{1}/{2}'.format(
                self.token_version,
                _user_type,
                _from
            )
642409
def get_access_token(self) -> str:
        
        if self._service_token:
            return self._service_token
        if self._app_id and self._login and self._password:
            try:
                if self.login():
                    url_params = self.auth_oauth2()
                    if 'access_token' in url_params:
                        return url_params['access_token']
            finally:
                self.close()
116304
public Authentication getAuthentication() {
        String username = getValueModel(LoginDetails.PROPERTY_USERNAME, String.class).getValue();
        String password = getValueModel(LoginDetails.PROPERTY_PASSWORD, String.class).getValue();
        return new UsernamePasswordAuthenticationToken( username, password );
    }
332990
def token(request, response, verify_user, context=None, **kwargs):
    
    token = request.get_header('Authorization')
    if token:
        try:
            verified_token = verify_user(token)
        except TypeError:
            verified_token = verify_user(token, context)
        if verified_token:
            return verified_token
        else:
            return False
    return None
840672
async def _get_security_token(self) -> None:
        """"""
        _LOGGER.debug('Requesting security token.')
        if self._credentials is None:
            return

        # Make sure only 1 request can be sent at a time.
        async with self._security_token_lock:
            # Confirm there is still no security token.
            if self._security_token is None:
                login_resp = await self._request(
                    'post',
                    LOGIN_ENDPOINT,
                    json=self._credentials,
                    login_request=True,
                )

                return_code = int(login_resp.get('ReturnCode', 1))
                if return_code != 0:
                    if return_code == 203:
                        # Invalid username or password.
                        _LOGGER.debug('Invalid username or password')
                        self._credentials = None
                    raise MyQError(login_resp['ErrorMessage'])

                self._security_token = login_resp['SecurityToken']
664404
def get_basic_auth_token(self):
        
        return urllib3.util.make_headers(basic_auth=self.username + ':' + self.password)\
                           .get('authorization')
644050
def token(self) -> str:
        

        return self.value[0] if self in (Role.USER, Role.ROLE_REMOVE) else self.name
512960
def authenticate(self):
        
        if self._auth_token is None or self._token_expiry < time.time():
            self._perform_auth()

        yield self._auth_token
1051383
def get_auth_token(self, user_payload):
        
        token = user_payload.get('token') or None
        if not token:
            raise ValueError('`user_payload` must provide api token')

        return '{auth_header_prefix} {token}'.format(
            auth_header_prefix=self.auth_header_prefix, token=token)
562810
def token(self):
        
        if self._token is None or \
           datetime.datetime.now() >= self._token_expires_on:
            if self._referer_url is None:
                self._generateForTokenSecurity(username=self._username,
                                           password=self._password,
                                           tokenUrl=self._token_url)
            else:
                self._generateForTokenSecurity(username=self._username,
                                               password=self._password,
                                               tokenUrl=self._token_url,
                                               client="referer")
        return self._token
1138547
def get_token(username, password, server):
    
    method = 'PUT'
    uri = 'https://' + server + '/authenticate'
    token = ''

    authinfo = {
        "username": username,
        "password": password,
        "local_user": username}

    token = tonicdns_client(uri, method, token, data=authinfo)

    return token