Google_Sheet_Settings::get_auth_url()

Create and retrieve an OAuth dialog for Google Sheets.


Return Return

(string) the Oauth dialog uri.


Source Source

File: src/integrations/google-sheet/settings/settings-google-sheet.php

	public function get_auth_url() {

		// Create nonce.
		$nonce = wp_create_nonce( 'automator_api_google_authorize' );

		// Construct the redirect uri.
		$redirect_uri = add_query_arg(
			array(
				'post_type'   => 'uo-recipe',
				'page'        => 'uncanny-automator-config',
				'tab'         => 'premium-integrations',
				'integration' => 'google-sheet',
			),
			admin_url( 'edit.php' )
		);

		set_transient( 'automator_api_google_authorize_nonce', $nonce, 3600 );

		// Construct the OAuth uri.
		$auth_uri = add_query_arg(
			array(
				'action'       => 'authorization_request',
				'scope'        => $this->get_helper()->client_scope,
				'redirect_url' => rawurlencode( $redirect_uri ),
				'nonce'        => $nonce,
				'plugin_ver'   => InitializePlugin::PLUGIN_VERSION,
			),
			$this->get_helper()->automator_api
		);

		return $auth_uri;
	}