获取access token
@param code
@return
331570
public AccessToken getAccessToken(String code) {
        String url = WxEndpoint.get("url.oauth.accesstoken.get");
        String formatUrl = String.format(url, wxClient.getClientId(), wxClient.getClientSecret(), code);
        logger.debug("get access token: {}", formatUrl);
        String response = wxClient.get(formatUrl, false);
        return JsonMapper.defaultMapper().fromJson(response, AccessToken.class);
    }
676978
def get_access_token(self, code):
        

        payload = {'redirect_uri': self.redirect_uri,
                   'code': code,
                   'grant_type': 'authorization_code'}

        headers = self._make_authorization_headers()

        response = requests.post(self.OAUTH_TOKEN_URL, data=payload,
            headers=headers, verify=LOGIN_VERIFY_SSL_CERT)
        if response.status_code is not 200:
            raise MercedesMeAuthError(response.reason)
        token_info = response.json()
        token_info = self._add_custom_values_to_token_info(token_info)
        self._save_token_info(token_info)
        return token_info
1293010
def get_access_token(self, code):
        
        self.token = self.oauth.fetch_token(
            token_url=self.access_token_url,
            client_id=self.client_id,
            client_secret=self.client_secret,
            scope=self.scope,
            code=code
        )
        return self.token.get("access_token")
1263389
def request_access_token(self, code, redirect_uri=None):
        '''
        
        '''
        redirect = redirect_uri or self._redirect_uri
        resp_text = _http('POST', 'https://api.weibo.com/oauth2/access_token',
                          client_id=self._client_id, client_secret=self._client_secret,
                          redirect_uri=redirect, code=code, grant_type='authorization_code')
        r = _parse_json(resp_text)
        current = int(time.time())
        expires = r.expires_in + current
        remind_in = r.get('remind_in', None)
        if remind_in:
            rtime = int(remind_in) + current
            if rtime < expires:
                expires = rtime
        return JsonDict(access_token=r.access_token, expires=expires, uid=r.get('uid', None))
136976
public static Emoji getEmoji(String code) {

		Matcher m = shortCodePattern.matcher(code);
		

		// test for shortcode with colons
		if (m.find()) {
			code = m.group(1);
		}
		
		Emoji emoji = selectFirst(
				EmojiManager.data(),
				having(on(Emoji.class).getEmoji(), Matchers.equalTo(code)).or(having(on(Emoji.class).getEmoji(), Matchers.equalTo(code)))
						.or(having(on(Emoji.class).getHexHtml(), Matchers.equalToIgnoringCase(code)))
						.or(having(on(Emoji.class).getDecimalHtml(), Matchers.equalToIgnoringCase(code)))
						.or(having(on(Emoji.class).getDecimalSurrogateHtml(), Matchers.equalToIgnoringCase(code)))
						.or(having(on(Emoji.class).getHexHtmlShort(), Matchers.equalToIgnoringCase(code)))
						.or(having(on(Emoji.class).getDecimalHtmlShort(), Matchers.equalToIgnoringCase(code)))
						.or(having(on(Emoji.class).getAliases(), Matchers.hasItem(code)))
						.or(having(on(Emoji.class).getEmoticons(), Matchers.hasItem(code))));

		return emoji;
	}
131491
public function getAccessToken($code, $redirectUri = null, $grant_type = 'authorization_code')
    {
        //Request Params
        $params = [
        'code' => $code,
        'grant_type' => $grant_type,
        'client_id' => $this->getApp()->getClientId(),
        'client_secret' => $this->getApp()->getClientSecret(),
        'redirect_uri' => $redirectUri
        ];

        $params = http_build_query($params);

        $apiUrl = static::AUTH_TOKEN_URL;
        $uri = $apiUrl . "?" . $params;

        //Send Request through the DropboxClient
        //Fetch the Response (DropboxRawResponse)
        $response = $this->getClient()
        ->getHttpClient()
        ->send($uri, "POST", null);

        //Fetch Response Body
        $body = $response->getBody();

        //Decode the Response body to associative array
        //and return
        return json_decode((string) $body, true);
    }
984391
protected function getTokenUrl($code) {
		return $this->providerOptions['access_token'] . '?client_id=' . $this->client_id . '&client_secret=' . $this->client_secret . '&code=' . $code . '&redirect_uri=' . urlencode($this->getState('redirect_uri'));
	}
1201489
def request_access_token(self, code, redirect_uri=None):
        '''
        
        '''
        r = self._mixin.request_access_token(code, redirect_uri)
        self._access_token = r.access_token
        return r
1283586
def authorization_code(self, request, data, client):
        
        grant = self.get_authorization_code_grant(request, request.POST,
                client)
        if constants.SINGLE_ACCESS_TOKEN:
            at = self.get_access_token(request, grant.user, grant.scope, client)
        else:
            at = self.create_access_token(request, grant.user, grant.scope, client)
            rt = self.create_refresh_token(request, grant.user, grant.scope, at,
                    client)

        self.invalidate_grant(grant)

        return self.access_token_response(at)
136824
public function get($code=null, $token=null)
    {
        if (!$code || !DataHelper::verify_code($code)) {
            $code = DataHelper::random(4, false);
        }
        $code = strtoupper($code);
        
        if ($token && DataHelper::is_token($token)) {
            $this->getTokenInstance()->refreshData($token, ['code' => $code]);
        } else {
            $token = $this->getTokenInstance()->get(['code' => $code]);
        }
        
        return [
            //'code'  => $code, // 不要返回，仅用于测试
            'token'     => $token,
            'base64'    => base64_encode($this->getImageHandler()->getBody($code)),
        ];
    }
1167860
public function getAccessToken($code, $callback_url = 'https://api.vk.com/blank.html')
    {
        if (!is_null($this->access_token) && $this->auth) {
            throw new VKException('Already authorized.');
        }

        $parameters = array(
            'client_id' => $this->app_id,
            'client_secret' => $this->api_secret,
            'code' => $code,
            'redirect_uri' => $callback_url
        );

        $rs = json_decode($this->request(
            $this->createUrl(self::ACCESS_TOKEN_URL, $parameters)), true);

        if (isset($rs['error'])) {
            throw new VKException($rs['error'] .
                (!isset($rs['error_description']) ?: ': ' . $rs['error_description']));
        } else {
            $this->auth = true;
            $this->access_token = $rs['access_token'];
            return $rs;
        }
    }
732413
public OAuthSession exchangeCode(String code, HttpUrl redirectUrl) throws IOException {
    HttpUrl url = baseUrl.newBuilder("oauth.access")
        .addQueryParameter("client_id", clientId)
        .addQueryParameter("client_secret", clientSecret)
        .addQueryParameter("code", code)
        .addQueryParameter("redirect_uri", redirectUrl.toString())
        .build();
    Request request = new Request.Builder()
        .url(url)
        .build();
    Call call = httpClient.newCall(request);
    try (Response response = call.execute()) {
      JsonAdapter<OAuthSession> jsonAdapter = moshi.adapter(OAuthSession.class);
      return jsonAdapter.fromJson(response.body().source());
    }
  }
737749
public function getAccessTokenResponse($code)
    {
        $postKey = (version_compare(ClientInterface::VERSION, '6') === 1) ? 'form_params' : 'body';

        $response = $this->getHttpClient()->post($this->getTokenUrl(), [
            'headers' => ['Accept' => 'application/json'],
            $postKey => $this->getTokenFields($code),
        ]);

        return json_decode($response->getBody(), true);
    }
1357453
function(code, callback) {
    return postParams(this.tokenServiceUrl, {
      grant_type : "authorization_code",
      code : code,
      client_id : this.clientId,
      client_secret : this.clientSecret,
      redirect_uri : this.redirectUri
    }, callback);
  }
1300577
public function getOAuth2AccessToken($code) {
        $url = sprintf(self::OAUTH2_ACCESS_TOKEN_URL, $this->appId, $this->appSecret, $code);
        $client = $this->getHttpClient();
        $client->setUrl($url);
        $client->setHeaderArray(['Content-Type: application/json']);

        if (!$client->exec()) {
            throw new Exception("call get oauth2 access token fail");
        }

        $result = json_decode($client->getResponse(), true);
        if (!(isset($result['access_token']) && isset($result['openid']))) {
            throw new Exception("call get oauth2 access token fail url({$url}) access_token or openid is not exists, response:" . $client->getResponse());
        }

        return ['accessToken' => trim($result['access_token']), 'openId' => trim($result['openid'])];
    }
956192
def get_token_by_code(self, code):
        ''''''
        url = 'https://openapi.youku.com/v2/oauth2/token'
        data = {'client_id': self.client_id,
                'client_secret': self.client_secret,
                'grant_type': 'authorization_code',
                'code': code,
                'redirect_uri': self.redirect_uri}
        r = requests.post(url, data=data)
        check_error(r)
        return r.json()
988651
public function getOAuthToken($code)
    {
        // Build data array
        $data = array(
            "grant_type"    => "authorization_code",
            "client_id"     => $this->client_id,
            "client_secret" => $this->client_secret,
            "code"          => $code
        );

        // Perform post request
        $response = $this->request->post("oauth/token", $data);

        return $response;
    }