Zoom_Helpers::refresh_token()

refresh_token


Parameters Parameters

$client

(Required)


Top ↑

Return Return

(void)


Source Source

File: src/integrations/zoom/helpers/zoom-helpers.php

	public function refresh_token() {
		$client = array();
		// Get the API key and secret
		$consumer_key    = trim( get_option( 'uap_automator_zoom_api_consumer_key', '' ) );
		$consumer_secret = trim( get_option( 'uap_automator_zoom_api_consumer_secret', '' ) );
		if ( empty( $consumer_key ) || empty( $consumer_secret ) ) {
			return false;
		}
		// Set the token expiration to 1 minute as recommended in the docuemntation
		$client['expires'] = time() + 60;
		$payload = array(
			'iss' => $consumer_key,
			'exp' => $client['expires'],
		);
		// Generate the access token using the JWT library
		$token = JWT::encode( $payload, $consumer_secret );
		$client['access_token'] = $token;
		$client['refresh_token'] = $token;
		// Cache it in settings
		update_option( '_uncannyowl_zoom_settings', $client );
		return $client;
	}