Google_Calendar_Helpers::auth_persist_connection( string $api_message = '', string $secret = '' )

Method auth_persist_connection.


Description Description

Save the connection data to wp_options.


Top ↑

Parameters Parameters

$api_message

(Optional) The secret message from the API.

Default value: ''

$secret

(Optional) The secret token.

Default value: ''


Top ↑

Return Return

(boolean) True if persists successfully. Otherwise, false.


Source Source

File: src/integrations/google-calendar/helpers/google-calendar-helpers.php

	protected function auth_persist_connection( $api_message = '', $secret = '' ) {

		$tokens = Automator_Helpers_Recipe::automator_api_decode_message( $api_message, $secret );

		if ( false !== $tokens ) {

			if ( $this->has_missing_scopes( $tokens ) ) {

				$this->redirect_with_error( esc_html__( 'missing_scope', 'uncanny-automator' ) );

			}

			update_option( self::OPTION_KEY, $tokens );

			return true;

		}

		return false;
	}