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 🙏

© 2024 – Pkg Stats / Ryan Hefner

expo-social-login

v1.2.0

Published

expo social login package

Downloads

47

Readme

expo-social-login

Expo Social Login is a package that makes it easy to implement social login in your Expo app. With just a few lines of code, you can enable your users to log in with their Facebook, Google, Apple, or Instagram accounts.

The package uses the Expo AuthSession module to handle the OAuth2 flow, and provides a simple and consistent API for each social network. It also returns the access tokens and user profiles, making it easy to integrate with your existing authentication system.

screenshot

Features

  • login with Facebook
  • login with Google
  • login with Instagram
  • login with Apple

Compatibility

This package is compatible with expo version 45 and above.

How to use this cute package

Install the package

using yarn

yarn add expo-social-login

using npm

npm install expo-social-login

Use it in your login/register screen

import { SocialAuth } from 'expo-social-login'

const LoginOrRegisterScreen = () => {
    return <View>

        ...
        <SocialAuth
            googleAndroidClientId={process.env.GOOGLE_ANDROID_CLIENT_ID}
            googleExpoClientId={process.env.GOOGLE_EXPO_CLIENT_ID}
            googleIosClientId={process.env.GOOGLE_IOS_CLIENT_ID}
            appId={process.env.INSTAGRAM_APP_ID}
            appSecret={process.env.INSTAGRAM_APP_SECRET}
            redirectUrl={process.env.INSTAGRAM_REDIRECT_URL}
            facebookAppId={process.env.FACEBOOK_APP_ID}
            enableInstagram={true}
            onSignInSuccess: (provider, token) => console.log(provider,token)
            onError: (error) => console.log(error)
            onCancel: () => console.log('Social Auth Cancelled')
        />
        ...

    </View>
}

export default LoginOrRegisterScreen

The above example with render the component like this:

SocialLogin

The icons displayed are clickable and will initiate a login/register session.

You can also cherry-pick which social auth you'd like to use, see example below

import { AppleAuth, FacebookAuth, GoogleAuth, Instagram } from 'expo-social-login'
...

const LoginOrRegisterScreen = () => {
    return <View>
    ...
    <Text>This is a login or registration screen</Text>
    ...

    <AppleAuth
        onError={(error)=>console.log('Apple auth error',error)}
        onSuccess={(token) => console.log('Apple', token)}
    />
    <GoogleAuth
        googleAndroidClientId={process.env.GOOGLE_ANDROID_CLIENT_ID}
        googleExpoClientId={process.env.GOOGLE_EXPO_CLIENT_ID}
        googleIosClientId={process.env.GOOGLE_IOS_CLIENT_ID}
        onError={(error)=>console.log('Google auth error',error)}
        onSuccess={(token) => console.log('Google auth token', token)}
    />
    <Instagram
        appId={process.env.INSTAGRAM_APP_ID}
        appSecret={process.env.INSTAGRAM_APP_SECRET}
        redirectUrl={process.env.INSTAGRAM_REDIRECT_URL}
        onError={(error)=>console.log('Instagram auth error',error)}
        onSuccess={(token) => console.log('Instagram auth token', token)}
    />
    <FacebookAuth
        facebookAppId={process.env.FACEBOOK_APP_ID}
        onSuccess={(token) => console.log('facebook auth token', token)}
        onError={(error)=>console.log('Facebook auth error',error)}
    />
    </View>
}

export default LoginOrRegisterScreen

If you wish to use a custom logo or button for your Social auth you can use the customButton prop and provide your own image, text or button. The onPress functionality has already been implemented internally

...
    <FacebookAuth
        facebookAppId={process.env.FACEBOOK_APP_ID}
        onSuccess={(token) => console.log('facebook auth token', token)}
        onError={(error)=>console.log('Facebook auth error',error)}
        customButton={<View><Text>Login with Facebook</Text></View>}
    />
...

Tada! and you're good to go

social media