npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fiction-expo-social-auth

v2.5.0

Published

Effortless social authentication for React, React Native (Expo), Vue.js, Svelte, and Next.js. Supports Google, Facebook, and Apple Sign-In with a unified API.

Readme

Fiction Expo Social Auth

npm version TypeScript License: ISC

Universal social authentication for React, React Native, Vue.js, Svelte, and Next.js.

Get Google, Facebook, and Apple Sign-In working in under 5 minutes — no OAuth credential management required!


✨ Features

  • 🔐 Google Sign-In — Full support across all platforms
  • 📘 Facebook Sign-In — OAuth flow for all platforms
  • 🍎 Apple Sign-In — Native on iOS, web fallback on others
  • 📱 Cross-Platform — React Native (Expo), React Web, Vue.js, Svelte, Next.js
  • 🎯 Unified API — Same code pattern works everywhere
  • Framework Hooks/Stores — Native integrations for React, Vue, Svelte
  • 🔷 TypeScript — Full type definitions included
  • 🔒 Privacy First — We don't store any user data

📊 Platform Support

| Platform | Google | Facebook | Apple | |----------|:------:|:--------:|:-----:| | React / Next.js | ✅ | ✅ | ✅ | | React Native (Expo) | ✅ | ✅ | ✅ Native | | Vue.js 3 | ✅ | ✅ | ✅ | | Svelte | ✅ | ✅ | ✅ | | Angular | ✅ | ✅ | ✅ |


📦 Installation

npm install fiction-expo-social-auth

🚀 Quick Start

React / React Native / Next.js

import { useSocialLogin } from 'fiction-expo-social-auth';

function LoginButton() {
  const { login, loading, user, error } = useSocialLogin('google');

  const handleLogin = async () => {
    const result = await login();
    if (result.action === 'success') {
      console.log('Welcome!', result.user.name);
    }
  };

  return (
    <button onClick={handleLogin} disabled={loading}>
      {loading ? 'Signing in...' : 'Sign in with Google'}
    </button>
  );
}

Vue.js 3

<script setup>
import { useSocialLogin } from 'fiction-expo-social-auth/vue';

const google = useSocialLogin('google');
const facebook = useSocialLogin('facebook');
</script>

<template>
  <button @click="google.login" :disabled="google.loading.value">
    {{ google.loading.value ? 'Signing in...' : 'Sign in with Google' }}
  </button>
  
  <button @click="facebook.login" :disabled="facebook.loading.value">
    {{ facebook.loading.value ? 'Signing in...' : 'Sign in with Facebook' }}
  </button>
  
  <div v-if="google.user.value">
    Welcome, {{ google.user.value.name }}!
  </div>
</template>

Svelte

<script>
  import { createSocialLogin } from 'fiction-expo-social-auth/svelte';
  
  const google = createSocialLogin('google');
  const facebook = createSocialLogin('facebook');
</script>

<button on:click={google.login} disabled={$google.loading}>
  {$google.loading ? 'Signing in...' : 'Sign in with Google'}
</button>

<button on:click={facebook.login} disabled={$facebook.loading}>
  {$facebook.loading ? 'Signing in...' : 'Sign in with Facebook'}
</button>

{#if $google.user}
  <p>Welcome, {$google.user.name}!</p>
{/if}

Angular

// In your component
import { Component } from '@angular/core';
import { SocialLoginService, createSocialLoginService } from 'fiction-expo-social-auth/angular';

@Component({
  selector: 'app-login',
  template: `
    <button (click)="login()" [disabled]="auth.loading">
      {{ auth.loading ? 'Signing in...' : 'Sign in with Google' }}
    </button>
    <div *ngIf="auth.user">Welcome, {{ auth.user.name }}!</div>
  `
})
export class LoginComponent {
  auth = createSocialLoginService();
  
  async login() {
    await this.auth.loginWithGoogle();
  }
}

Direct Functions (Any Framework)

import { googleLogin, facebookLogin, appleLogin } from 'fiction-expo-social-auth';

// Works in any JavaScript environment
const result = await googleLogin();

if (result.action === 'success') {
  console.log('Email:', result.user.email);
  console.log('Name:', result.user.name);
  console.log('Photo:', result.user.photo);
  if (result.user.phoneNumber) {
    console.log('Phone:', result.user.phoneNumber);
  }
}

📖 API Reference

React Hook: useSocialLogin(provider)

const { login, loading, error, user, result, reset } = useSocialLogin('google');

| Property | Type | Description | |----------|------|-------------| | login | () => Promise<AuthResult> | Trigger login flow | | loading | boolean | True while authenticating | | error | string \| null | Error message if failed | | user | AuthUser \| null | User data if successful | | result | AuthResult \| null | Full result object | | reset | () => void | Reset state |

Vue Composable: useSocialLogin(provider)

Import from fiction-expo-social-auth/vue

const { login, loading, error, user, result, reset } = useSocialLogin('google');

Returns Readonly<Ref<T>> for reactive properties.

Svelte Store: createSocialLogin(provider)

Import from fiction-expo-social-auth/svelte

const google = createSocialLogin('google');

// Access state with $ prefix
$google.loading
$google.error
$google.user

// Call methods directly
await google.login();
google.reset();

AuthResult

// Success
{
  action: 'success';
  user: {
    id: string;
    email: string;
    name: string;
    photo: string;
  };
}

// Failure
{
  action: 'failed';
  error: string;
  errorCode?: string;
}

🍎 Apple Sign-In Setup (iOS)

For native Apple Sign-In on iOS:

npx expo install expo-apple-authentication

Configure app.json:

{
  "expo": {
    "ios": {
      "usesAppleSignIn": true
    },
    "plugins": ["expo-apple-authentication"]
  }
}

⚠️ Error Handling

const result = await googleLogin();

if (result.action === 'failed') {
  switch (result.errorCode) {
    case 'ERR_REQUEST_CANCELED':
      // User cancelled - don't show error
      break;
    case 'ERR_NETWORK':
      alert('Check your internet connection');
      break;
    default:
      alert(result.error);
  }
}

🔒 Privacy

  • No data storage — All data goes directly to your app
  • Session-only — Cleared immediately after auth
  • No tracking — We don't collect analytics
  • Open source — Review our code on GitHub

📞 Support


📜 License

ISC License © Fiction Developers