Skip to main content
@capgo/capacitor-social-login Auth & Security Open source

Social Login Capacitor plugin

Authenticate users with Google, Facebook, and Apple Sign-In for easy social login

Install

bun add @capgo/capacitor-social-login bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-social-login
  • pnpm add @capgo/capacitor-social-login
  • yarn add @capgo/capacitor-social-login

Guide

How to use Social Login in Capacitor

Using @capgo/capacitor-social-login

All social logins in one plugin for Web, iOS, and Android. It supports Google, Apple, Facebook, Twitter/X, and generic OAuth2/OIDC providers such as GitHub, Microsoft Entra ID, Auth0, Okta, and Keycloak.

Install

npm install @capgo/capacitor-social-login
npx cap sync

What This Plugin Exposes

  • initialize - Initialize the plugin.
  • login - Login with the selected provider.
  • logout - Logout.
  • isLoggedIn - IsLoggedIn.

Example Usage

initialize

Initialize the plugin.

import { SocialLogin } from '@capgo/capacitor-social-login';

await SocialLogin.initialize({ telegram: { botId: '123456789' } });

login

Login with the selected provider.

import { SocialLogin } from '@capgo/capacitor-social-login';

const result = await SocialLogin.login({
  provider: 'facebook',
  options: { permissions: ['permission'] },
});
// The result holds sensitive values: use it without logging it.

logout

Logout.

import { SocialLogin } from '@capgo/capacitor-social-login';

await SocialLogin.logout({} as {
    provider: 'apple' | 'google' | 'facebook' | 'twitter' | 'oauth2';
    providerId?: string;
  });

isLoggedIn

IsLoggedIn.

import { SocialLogin } from '@capgo/capacitor-social-login';

const result = await SocialLogin.isLoggedIn({ provider: 'apple' });
console.log(result);

Full Reference

Keep going from Using @capgo/capacitor-social-login

If you are using Using @capgo/capacitor-social-login to plan authentication and account flows, connect it with @capgo/capacitor-social-login for the implementation detail in @capgo/capacitor-social-login, Getting Started for the implementation detail in Getting Started, @capgo/capacitor-passkey for the implementation detail in @capgo/capacitor-passkey, @capgo/capacitor-native-biometric for the implementation detail in @capgo/capacitor-native-biometric, and Two-factor authentication for the implementation detail in Two-factor authentication.

FAQ

Social Login plugin FAQ

How do I install the Social Login plugin in a Capacitor app?

Run "bun add @capgo/capacitor-social-login" (or "npm install @capgo/capacitor-social-login"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-social-login" in your app code.

Does @capgo/capacitor-social-login work with React, Vue and Angular?

Yes. Social Login is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-social-login support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-social-login free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-social-login/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Social Login without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Social Login changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo