Get refresh token from session and decrypt it.

@return mixed
493245
public function get()
    {
        $this->verify();

        $token = $this->storage->get('token');

        return $this->encryptor->decrypt($token);
    }
1025026
public function getOauthRefreshToken($refresh_token){
        $result = $this->http_get(self::API_BASE_URL_PREFIX.self::OAUTH_REFRESH_URL.'appid='.$this->appid.'&grant_type=refresh_token&refresh_token='.$refresh_token);
        if ($result)
        {
            $json = json_decode($result,true);
            if (!$json || !empty($json['errcode'])) {
                $this->errCode = $json['errcode'];
                $this->errMsg = $json['errmsg'];
                return false;
            }
            $this->user_token = $json['access_token'];
            return $json;
        }
        return false;
    }
610008
public function refresh()
    {
        $token = Auth::guard()->refresh();

        return response()->json([
            'status' => 'ok',
            'token' => $token,
            'expires_in' => Auth::guard()->factory()->getTTL() * 60
        ]);
    }
1293302
public function refresh($refreshToken)
    {
        $queryStr = [
            'appid'         => $this->getAppId(),
            'grant_type'    => 'refresh_token',
            'refresh_token' => $refreshToken,
        ];

        $this->apitype = 'sns';
        $this->module  = 'oauth2';
        $res           = $this->_get('refresh_token', $queryStr);

        return $res;
    }
888472
public function getRefreshTokenResponse($refresh_token)
    {
        $response = $this->getHttpClient()->post($this->getTokenUrl(), [
            'headers' => ['Accept' => 'application/json'],
            'form_params' => $this->getRefreshTokenFields($refresh_token),
        ]);
        return json_decode($response->getBody(), true);
    }
750294
public function refreshToken()
    {
        if (is_null($this->token) || is_null($this->token->getRefreshToken())) {
            return null;
        }

        $grant = new RefreshToken();
        $refreshToken = $this->provider->getAccessToken($grant, [
            'refresh_token' => $this->token->getRefreshToken()
        ]);

        $this->token = $refreshToken;


        return $this->token;
    }
1125426
public function reloadWithToken()
    {
        $location = $this->redirectURL();
        $locationJS = Convert::raw2js($location);
        $locationATT = Convert::raw2att($location);
        $body = <<<HTML
<script>location.href='$locationJS';</script>
<noscript><meta http-equiv="refresh" content="0; url=$locationATT"></noscript>
You are being redirected. If you are not redirected soon, <a href="$locationATT">click here to continue</a>
HTML;

        // Build response
        $result = new HTTPResponse($body);
        $result->redirect($location);
        return $result;
    }
944005
public function getNewToken()
    {
        $post = array(
            'auth' => array(
                'username' => $this->username,
                'password' => $this->password,
            ),
        );
        return $this->http->call(HttpMethod::POST, $this->host.'/auth', $post)->token;
    }
1201694
public function refresh_token() {
		if (!isset($this->auth_details['refresh_token']))
			trigger_error('Error refreshing token. There is no refresh token set on this object.', E_USER_ERROR);
		$params = array(
			'grant_type' => 'refresh_token',
			'refresh_token' => $this->auth_details['refresh_token']
		);
		return $this->_request('oauth', $params, self::OAUTH_TOKEN_URL);
	}
1183028
public function checkSession()
	{
		// Get session token
		$session_token = isset($_COOKIE[$this->cookie_name]) ? $_COOKIE[$this->cookie_name]
			: (isset($_SERVER['HTTP_AUTH_TOKEN']) ? $_SERVER['HTTP_AUTH_TOKEN'] : null);

		// Get reference to session state machine
		if ($session_token) {
			// Get session machine ref
			$session_id = (array) $this->session_machine_ref_prefix;
			$session_id[] = $session_token;
			$this->session_machine = $this->smalldb->ref($session_id);

			// Check session
			if ($this->session_machine->state == '') {
				// Invalid token
				$this->session_machine = $this->smalldb->ref($this->session_machine_null_ref);
			} else {
				// TODO: Validate token, not only session existence, and check whether session is in valid state (invoke a transition to check).

				// TODO: Session should tell how long it will last so the cookie should have the same duration.

				// Token is good - refresh cookie
				setcookie($this->cookie_name, $session_token, time() + $this->cookie_ttl, '/', null, !empty($_SERVER['HTTPS']), true);
			}
		} else {
			// No token
			$this->session_machine = $this->smalldb->ref($this->session_machine_null_ref);
		}

		// Update token on state change
		$t = $this;
		$this->session_machine->afterTransition()->addListener(function($ref, $transition_name, $arguments, $return_value, $returns) use ($t) {
			if (!$ref->state) {
				// Remove cookie when session is terminated
				setcookie($t->cookie_name, null, time() + $t->cookie_ttl, '/', null, !empty($_SERVER['HTTPS']), true);
				if (isset($_SESSION)) {
					// Kill PHP session if in use
					session_regenerate_id(true);
				}
			} else {
				// Update cookie on state change
				setcookie($t->cookie_name, $ref->id, time() + $t->cookie_ttl, '/', null, !empty($_SERVER['HTTPS']), true);
			}
		});

		// Everything else is up to the state machine
	}
342971
function refreshToken($accessToken, $sessionHandle) {
		$code = $this->request ( 'GET', $this->url ( 'AccessToken', '' ), array (
				'oauth_token' => $accessToken,
				'oauth_session_handle' => $sessionHandle 
		) );
		if ($this->response ['code'] == 200) {
			
			$response = $this->extract_params ( $this->response ['response'] );
			
			return $response;
		} else {
			$this->response ['helper'] = "TokenFatal";
			return $this->response;
		}
	}
297067
public function refreshToken()
    {
        $data = $this->parent->performAPICallWithJsonResponse('get', '/refresh_token');

        if (array_key_exists('token', $data)) {
            return $data['token'];
        }

        throw UnauthorizedException::invalidToken();
    }
109455
public function getAccessToken()
    {
        //Check if AccessToken needs to be refreshed
        $now = time();
        $time = time();
        $difference = $this->access_token_expire - $time;
        if ($difference < strtotime('15 minutes', 0)) {
            $this->refreshAccessToken();
        }

        return $this->access_token;
    }
98979
public function getOauthRefreshToken($refresh_token)
    {
        $appid = $this->config->get('appid');
        $url = "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid={$appid}&grant_type=refresh_token&refresh_token={$refresh_token}";
        return $this->httpGetForJson($url);
    }
24762
public function getAccessToken()
    {
        /** @var AccessToken $accessToken */
        if ($accessToken = $this->cache->get(static::SESSION_ACCESS_TOKEN_KEY)) {
            if (!$accessToken->hasExpired()) {
                return $accessToken;
            }
        }
        $accessToken = $this->authClient->getAccessToken('client_credentials');
        $ttl = $accessToken->getExpires() - time();
        $this->cache->save(static::SESSION_ACCESS_TOKEN_KEY, $accessToken, $ttl);

        return $accessToken;
    }
620160
protected function getToken()
    {
        $temp = $this->request->session()->get('oauth.temp');

        return $this->server->getTokenCredentials(
            $temp, $this->request->get('oauth_token'), $this->request->get('oauth_verifier')
        );
    }
822095
protected function getRefreshToken(){
		// check if RefreshToken is already stored
		$refreshToken = $this->getConfig()->getStorage()->getRefreshToken();
		if(null !== $refreshToken){
			return $refreshToken;
		}
		
		// get device token required for RefreshToken request
		$deviceToken = $this->getDeviceToken();
		if($deviceToken !== null && $deviceToken->canPoll()){
			// check if token exists and can be polled (depends on interval provided by the server)
			$params = array(
				'client_id' => $this->getConfig()->getClientId(),
				'code' => $deviceToken->getDeviceCode(),
				'grant_type' => 'device',
			);
			// request a RefreshToken
			$response = $this->sendPostRequest("oauth2waitress/oauth2.svc/token", $params);
			$output = $response['output'];
			$httpcode = $response['code'];
			
			// update LastPoll date to assure the correct polling interval
			$deviceToken->setLastPoll(new DateTime());
			$this->getConfig()->getStorage()->saveDeviceToken($deviceToken);
			
			switch($httpcode){
				case "200" : 
					$responseObject = json_decode($output);
					if(empty($responseObject->access_token)){
						// no AccessToken provided yet. Authorization is most likely pending.
						return null;
					}
					// AccessToken provided
					// create AccessToken and save it
					$accessToken = new AccessToken(new DateTime(), $responseObject->access_token, $responseObject->token_type, $responseObject->expires_in);
					$this->getConfig()->getStorage()->deleteAccessToken();
					$this->getConfig()->getStorage()->saveAccessToken($accessToken);
					if($responseObject->refresh_token){
						// if a RefreshToken was also provided, we create and save it, too.
						$refreshToken = new RefreshToken(new DateTime(), $responseObject->refresh_token);
						$this->getConfig()->getStorage()->saveRefreshToken($refreshToken);
					}
					return $refreshToken;
			}
		}
		return null;
	}