Get the application's access token as a string.
        If offline=True, use the concatenated app ID and secret
        instead of making an API call.
        <https://developers.facebook.com/docs/facebook-login/
        access-tokens#apptokens>
197973
def get_app_access_token(self, app_id, app_secret, offline=False):
        
        if offline:
            return "{0}|{1}".format(app_id, app_secret)
        else:
            args = {
                "grant_type": "client_credentials",
                "client_id": app_id,
                "client_secret": app_secret,
            }

            return self.request(
                "{0}/oauth/access_token".format(self.version), args=args
            )["access_token"]
566974
def get_application_access_token(application_id, application_secret_key, api_version=None):
    
    graph = GraphAPI(version=api_version)

    response = graph.get(
        path='oauth/access_token',
        client_id=application_id,
        client_secret=application_secret_key,
        grant_type='client_credentials'
    )

    try:
        data = parse_qs(response)

        try:
            return data['access_token'][0]
        except KeyError:
            raise GraphAPI.FacebookError('No access token given')
    except AttributeError:  # api_version >= 2.3 returns a dict
        return response['access_token'], None
222010
def verify_token(self):
        

        h = sha256()
        h.update(self.app_access_token.encode())
        return h.hexdigest()
1343034
def get_access_token(self, code, client_id, client_secret):
        ''' 
        
        '''
        headers = {
                'Content-Type' : 'application/json'
                }
        data = {
                'client_id' : client_id,
                'client_secret' : client_secret,
                'code' : code,
                }
        str_data = json.dumps(data)
        response = requests.request(method='POST', url=ACCESS_TOKEN_URL, headers=headers, data=str_data)
        status_code = response.status_code
        if status_code != 200:
            raise ValueError("{} -- {}".format(status_code, response.json()))
        return body['access_token']
504314
def auth_string(self):
        
        if not self._token:
            self.execute()

        if not self._token.expired:
            return 'Bearer {}'.format(self._token.access_token)

        if self.auto_refresh:
            self.execute()
            return 'Bearer {}'.format(self._token.access_token)

        raise TokenExpired()
1262036
private String getAuthTokenFromRequest(HttpServletRequest httpRequest) {
        String authToken = httpRequest.getHeader(AUTH_TOKEN_HEADER_KEY);

        if (authToken == null) {
            // token can also exist as request parameter
            authToken = httpRequest.getParameter(AUTH_TOKEN_PARAMETER_KEY);
        }

        return authToken;
    }
290317
public String auth_getSession(String authToken)
    throws FacebookException, IOException {
    if (null != this._sessionKey) {
      return this._sessionKey;
    }
    JSONObject d = (JSONObject) this.callMethod(FacebookMethod.AUTH_GET_SESSION, 
                                                new Pair<String, CharSequence>("auth_token", authToken.toString()));
    this._sessionKey = (String) d.get("session_key");
    Object uid = d.get("uid");
    try {
      this._userId = ((Long) uid).intValue();
    } catch (ClassCastException cce) {
      this._userId = Integer.parseInt((String) uid);
    } 
    if (this.isDesktop()) {
      this._sessionSecret = (String) d.get("secret");
    }
    return this._sessionKey;
  }
124006
private static function _createOauthUrlForOpenid($app_id, $app_secret, $code)
    {
        $urlObj = array();
        $urlObj['appid'] = $app_id;
        $urlObj['secret'] = $app_secret;
        $urlObj['code'] = $code;
        $urlObj['grant_type'] = 'authorization_code';
        $queryStr = http_build_query($urlObj);

        return 'https://api.weixin.qq.com/sns/oauth2/access_token?' . $queryStr;
    }
764173
function(handler) {
        if (typeof accessToken == 'undefined') {
            var body = {
                client_id: clientId,
                client_secret: clientSecret,
                username: username,
                password: password,
                grant_type: 'password'
            };

            if (thisObject.debug) {
                console.log("Making oAuth call...");
            }

            var options =  {
                url: 'https://app1pub.smappee.net/dev/v1/oauth2/token',
                headers: {
                    'Host': 'app1pub.smappee.net'
                },
                form: body
            };

            request.post(options, function (err, httpResponse, body) {
                if (err) {
                    return console.error('Request failed:', err);
                }
                if (thisObject.debug) {
                    console.log('Server responded with:', body);
                }

                accessToken = JSON.parse(body);
                handler(accessToken);
            });
        } else {
            handler(accessToken)
        }
    }
64539
def get_request_token(params = {})
      params[:oauth_callback] = params.delete(:callback_url)
      response = client.get_request_token(params)
      RequestToken.new(response[:oauth_token], response[:oauth_token_secret])
    end
422202
def get_access_token_from_code(
        self, code, redirect_uri, app_id, app_secret
    ):
        
        args = {
            "code": code,
            "redirect_uri": redirect_uri,
            "client_id": app_id,
            "client_secret": app_secret,
        }

        return self.request(
            "{0}/oauth/access_token".format(self.version), args
        )
1269569
def get_security_token!(parameters = {})
      username = parameters[:username] || @options.username
      password = parameters[:password] || @options.password
      appname = parameters[:appname] || @options.appname

      request_data = {
        'Username' => username,
        'Password' => password,
        'Appname' => appname
      }

      start_timer
      response = @connection.post(build_uri('GetToken'), MultiJson.dump(request_data.to_hash))
      end_timer

      log_get_security_token
      log_info("Response Status: #{response.status}")

      if response.status != 200
        raise make_get_security_token_error
      else
        raise_if_response_error(response)

        @security_token = response.body
      end
    end
154710
def get_access_token(self):
        
        if self.is_access_token_expired():

            if is_debug_enabled():
                debug('requesting new access_token')

            token = get_access_token(username=self.username,
                                     password=self.password,
                                     client_id=self.client_id,
                                     client_secret=self.client_secret,
                                     app_url=self.app_url)

            # lets make sure to refresh before we're halfway to expiring
            self.expires_at = time.time() + token['expires_in']/2
            self.access_token = token['access_token']

        return self.access_token
338938
def token_get(profile=None, **connection_args):
    '''
    
    '''
    kstone = auth(profile, **connection_args)
    token = kstone.service_catalog.get_token()
    return {'id': token['id'],
            'expires': token['expires'],
            'user_id': token['user_id'],
            'tenant_id': token['tenant_id']}
439171
def get_access_token(self, request, callback=None):
        ""
        raw_token = request.session.get(self.session_key, None)
        verifier = request.GET.get('oauth_verifier', None)
        if raw_token is not None and verifier is not None:
            data = {'oauth_verifier': verifier}
            callback = request.build_absolute_uri(callback or request.path)
            callback = force_text(callback)
            try:
                response = self.request('post', self.provider.access_token_url,
                                        token=raw_token, data=data, oauth_callback=callback)
                response.raise_for_status()
            except RequestException as e:
                logger.error('Unable to fetch access token: {0}'.format(e))
                return None
            else:
                return response.text
        return None
1055222
public String auth_createToken()
    throws FacebookException, IOException {
    T d = this.callMethod(FacebookMethod.AUTH_CREATE_TOKEN);
    return extractString(d);
  }
459723
def _obtain_api_token(self, username, password):
        """"""
        data = self._request("POST", "auth/apitoken",
                             {"username": username, "password": password},
                             reestablish_session=False)
        return data["api_token"]