returns a CF::UAA::TokenInfo object which includes the access token and metadata.
164938
def request_token(params)
    if scope = Util.arglist(params.delete(:scope))
      params[:scope] = Util.strlist(scope)
    end
    headers = {'content-type' => FORM_UTF8, 'accept' => JSON_UTF8,
        'authorization' => Http.basic_auth(@client_id, @client_secret) }
    reply = json_parse_reply(@key_style, *request(@token_target, :post,
        '/oauth/token', Util.encode_form(params), headers))
    raise BadResponse unless reply[jkey :token_type] && reply[jkey :access_token]
    TokenInfo.new(reply)
  end
684757
def get_access_token(self, verifier=None):
        
        
        if self._access_token is None:
            self._access_token, self._access_token_dict = self._get_access_token(verifier)
        return self._access_token
723577
def get_access_token(self, code):
        """"""
        try:
            self._token = super().fetch_token(
                MINUT_TOKEN_URL,
                client_id=self._client_id,
                client_secret=self._client_secret,
                code=code,
            )
        # except Exception as e:
        except MissingTokenError as error:
            _LOGGER.debug("Token issues: %s", error)
        return self._token
723345
def GetTokenInformation(token, information_class):
    
    data_size = ctypes.wintypes.DWORD()
    ctypes.windll.advapi32.GetTokenInformation(
        token, information_class.num, 0, 0, ctypes.byref(data_size)
    )
    data = ctypes.create_string_buffer(data_size.value)
    handle_nonzero_success(
        ctypes.windll.advapi32.GetTokenInformation(
            token,
            information_class.num,
            ctypes.byref(data),
            ctypes.sizeof(data),
            ctypes.byref(data_size),
        )
    )
    return ctypes.cast(data, ctypes.POINTER(TOKEN_USER)).contents
450349
def create_token(credential, opts = {})
      data, _status_code, _headers = create_token_with_http_info(credential, opts)
      return data
    end
373128
public static function info($access_token)
    {
        $opts = array('http' => array(
            'method'  => 'GET'
        ));

        $url = self::$clef_base_url."info?access_token=".$access_token;

        // exchange the oauth token for the user's info
        $context  = stream_context_create($opts);
        $response = file_get_contents($url, false, $context);

        if (!$response) {
            $response = json_decode($response, true);

            return $response;
        }

        return false;
    }
862890
def my_info(self, access_token):
        
        url = 'https://openapi.youku.com/v2/users/myinfo.json'
        data = {'client_id': self.client_id,
                'access_token': access_token}
        r = requests.post(url, data=data)
        check_error(r)
        return r.json()
906476
def _parse_access_token(self, resp_text):
        '  '
        r = self._qs2dict(resp_text)
        access_token = r.pop('access_token')
        expires = time.time() + float(r.pop('expires_in'))
        return JsonDict(access_token=access_token, expires=expires, **r)
635118
def get_access_token(self):
        
        if self.token_info and not self.is_token_expired(self.token_info):
            return self.token_info['access_token']

        token_info = self._request_access_token()
        token_info = self._add_custom_values_to_token_info(token_info)
        self.token_info = token_info
        return self.token_info['access_token']
906561
def token(self):
        '''
        '''
        auth_header = self.headers.get('Authorization', '')
        if 'Token ' in auth_header:
            return auth_header.partition('Token ')[-1]
        else:
            return auth_header
1145091
final public function getAuthenticationInfo($token)
    {
        // TODO: Retrieve Authentication Info from Cache
        $authInfo = $this->doGetAuthenticationInfo($token);
        if ($authInfo) {
            $this->_matchCredentials($token, $authInfo);
        }

        return $authInfo;

    }
190654
def auth_token(registry, repo):
    
    # TODO: Cache tokens?
    auth_info = auth_config.resolve_authconfig(registry)
    if auth_info:
        normalized = {k.lower(): v for k, v in six.iteritems(auth_info)}
        auth_info = (normalized.get("username"), normalized.get("password"))
    response = requests.get("https://{}/v2/".format(registry), timeout=3)
    if response.headers.get("www-authenticate"):
        try:
            info = www_authenticate.parse(response.headers['www-authenticate'])
        except ValueError:
            info = {}
    else:
        log.error("Received {} when attempting to authenticate with {}".format(
            response, registry))
        info = {}
    if info.get("bearer"):
        res = requests.get(info["bearer"]["realm"] +
                           "?service={}&scope=repository:{}:pull".format(
            info["bearer"]["service"], repo), auth=auth_info, timeout=3)
        res.raise_for_status()
        return res.json()
    return {}
423263
def info(self, token):
        
        verifier = JWT(key_jar=self.key_jar, allowed_sign_algs=[self.alg])
        _payload = verifier.unpack(token)
        if is_expired(_payload['exp']):
            raise ToOld('Token has expired')
        return _payload['sid'], _payload['ttype']
155710
private function userinfo($access_token){
		$userinfo = $this->serverGet('https://www.googleapis.com/oauth2/v1/userinfo', array('access_token' => $access_token), null, $headers);
		if (!empty($userinfo)){
			return $this->recursiveGetObjectVars(json_decode($userinfo));
		}
		else{
			$error = array(
				'code' => 'userinfo_error',
				'message' => 'Failed when attempting to query for user information',
				'raw' => array(
					'response' => $userinfo,
					'headers' => $headers
				)
			);

			$this->errorCallback($error);
		}
	}
899803
def info_authn(self):
        
        authz_header = request.headers.get('Authorization', '[none]')
        if (not authz_header.startswith('Bearer ')):
            return False
        token = authz_header[7:]
        return self.access_token_valid(
            token, "info_authn: Authorization header")
788513
def get_rest_token(self):
        
        uri = urllib.parse.quote_plus(
            "https://{}.{}/{}".format(self.sb_name, self.namespace_suffix, self.eh_name))
        sas = self.sas_key.encode('utf-8')
        expiry = str(int(time.time() + 10000))
        string_to_sign = ('{}\n{}'.format(uri, expiry)).encode('utf-8')
        signed_hmac_sha256 = hmac.HMAC(sas, string_to_sign, hashlib.sha256)
        signature = urllib.parse.quote(base64.b64encode(signed_hmac_sha256.digest()))
        return 'SharedAccessSignature sr={}&sig={}&se={}&skn={}' \
                .format(uri, signature, expiry, self.policy)
699474
def get_access_token(options = {}, *arguments)
      response = consumer.token_request(consumer.http_method, (consumer.access_token_url? ? consumer.access_token_url : consumer.access_token_path), self, options, *arguments)
      OAuth::AccessToken.from_hash(consumer, response)
    end