WP Manifestindependent plugin directory
manifest / integrations / sw-google-connect

SW - Google Connect

Wordpress plugin for google oauth

by Seniors · github.com/dazza-dev/sw-google-connect · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/dazza-dev/sw-google-connect/archive/refs/heads/main.zip

Readme

=== SW - Google Connect === Contributors: seniorswp Tags: google, oauth, api, business-profile, connect Requires at least: 5.8 Tested up to: 6.4 Requires PHP: 7.4 Stable tag: 1.0.0 License: GPL v2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html

Conecta una cuenta de Google por OAuth y provee el token de acceso a otros plugins. Genérico y reutilizable.

== Description ==

Maneja únicamente la CONEXIÓN OAuth con Google (Client ID + Secret + Conectar) y expone el token a otros plugins. El token puede autorizar cualquier API de Google (Business Profile, Gmail, Calendar, Drive, etc.) según los scopes que pidan los consumidores mediante el filtro swgc_scopes.

Reutilizable en varios proyectos: registra UNA app OAuth en tu Google Cloud, agrega el Redirect URI de cada sitio, y cada cliente conecta su propia cuenta.

== Public API ==

  • swgc_is_connected(): bool
  • swgc_access_token(): string|WP_Error — token válido, refrescado automáticamente
  • swgc_api_get($url): array|WP_Error — GET autenticado (JSON)
  • swgc_api_post($url, $body): array|WP_Error — POST autenticado (JSON)
  • swgc_disconnect(): void

Filtro para pedir scopes (aplica al conectar):

add_filter('swgc_scopes', function ($scopes) {
    $scopes[] = 'https://www.googleapis.com/auth/business.manage';
    return $scopes;
});

== Requisitos (lado Google) ==

  • App OAuth (Client ID + Secret) en Google Cloud, con el Redirect URI del sitio.
  • Pantalla de consentimiento con los scopes que se vayan a usar (publícala para un refresh token permanente; en modo "Testing" expira a los 7 días).

== Changelog ==

= 1.0.0 =

  • Conexión OAuth con Google (authorization code + refresh token) y API pública (swgc_access_token / swgc_api_get / swgc_api_post).

Read the full README on GitHub →