WebToNative
  • Getting started
  • Plugin Setup
    • OneSignal Set Up
    • Google AdMob Setup
    • In App Purchase - iOS Setup
    • In App Purchase - Android Setup
    • Firebase Notification Integration - iOS Setup
  • Social Login Integrations
    • Getting the SHA Key for Google Login
    • Create Google OAuth Client Id
    • Facebook Login Configuration
  • Javascript APIS
    • Getting Started
    • Status Bar
    • Pull To Refresh
    • Close App
    • Device Info
    • Clear App Cache
    • OneSignal Push Notification
    • Download Files
    • Printing Options
    • AdMob
    • Geo Location
    • Load In External Browser
    • Barcode Scan
    • In App Purchase - iOS Integration
    • In App Purchase - Android Integration
    • Social Login
    • Facebook App Events
    • Bottom Navigation
    • Clipboard
    • Screen Control
    • Background Location
    • Native Contacts
    • iOS App Tracking Transparency
    • Google Firebase Analytics
    • Haptic Feedback
    • Google Firebase Notification
    • Apps Flyer
    • App Review
    • Calender - iOS
    • Calendar - Android
    • Biometric Authentication
    • Media Player
    • Notification View
    • Offer Card
    • Cookie Update
    • App Launch Detection
    • Download Manager
    • Dynamic App Icon
    • File Sharing
  • Bluetooth - Android
  • Orientation Handling - Android
  • Website Plugins
    • Wordpress
      • Push notification (WooCommerce)
      • In-App Purchase
        • In-App Purchase (IAP) Configuration Guide for iOS and Android
        • In-App Purchase (WooCommerce)
        • In-App Purchase
      • Offercard
      • Biometric Authentication
      • Social Login
      • Webtonative media player
        • WebToNative Radio Player
        • MediaPlayer Native Control
    • Bubble.io
      • Customize Status Bar
      • Device-Based Element Visibility
      • Pull to Refresh (Android)
      • OneSignal Push Notification
        • Set External ID
        • Send Push Notification
        • Set/Remove Email or SMS Phone
        • Set Tag
      • Close App
      • Get Device Info
      • Clear App Cache (Android)
      • Screen Control
      • Facebook Events
        • Regular
        • Purchase
      • AdMob
      • Offercard
      • In-App Purchase
        • In-App Purchase (Android/iOS)
        • Get IAP Canceled Subscription List (iOS)
      • Social Login
      • Biometric Authentication
  • Shopify
    • Social Login
    • In-App Purchase
      • In-app purchase
    • Push Notification
      • Abandoned Cart
    • Status Bar Customization
    • Native Device Visibilty
    • Set Onesignal Tags
    • Pull to Refresh
    • Account Deletion
    • Biometric Authentication
  • Upload Apps
    • Android App
    • Ios App
Powered by GitBook
On this page

Was this helpful?

  1. Javascript APIS

Social Login

Integration of Social Login - Google, Facebook and Apple

You'll need to import the javascript file in your website before starting from this .
const { facebook, google, apple } = WTN.socialLogin;

//Login Commands
facebook.login({
  callback : function(value){
    console.log(value)
  }
});

google.login({
  callback : function(value){
    console.log(value)
  }
});

apple.login({
  callback : function(value){
    console.log(value)
  }
})

//Logout Commands
facebook.logout({
  callback : function(value){
    console.log(value)
  }
});

google.logout({
  callback : function(value){
    console.log(value)
  }
});

import { 
  login as loginFacebook, 
  logout as logoutFacebook 
} from "webtonative/SocialLogin/facebook"
import { 
  login as loginGoogle, 
  logout as logoutGoogle 
} from "webtonative/SocialLogin/google"
import { 
  login as loginApple 
} from "webtonative/SocialLogin/apple"

//Login Commands
loginFacebook({
  callback : function(value){
    console.log(value)
  }
});

loginGoogle({
  callback : function(value){
    console.log(value)
  }
});

loginApple({
  callback : function(value){
    console.log(value)
  }
})

//Logout Commands
logoutFacebook({
  callback : function(value){
    console.log(value)
  }
});

logoutGoogle({
  callback : function(value){
    console.log(value)
  }
});

Callback parameter object

Login :-

{
    "isSuccess":true,
    "accessToken":"EXXXXXQ0iSXpNGVOCMVi000ZAnlslBJIHgXXX2dfkW4HtGLUAuuZCcESjfZXXXQZBZBV",
    "userId":"1XXXXXXXXX519425",
    "type":"fbLoginToken"
}

Login Error :-

{
    "isSuccess":false,
    "error":"Error message for logout",
    "type":"fbLoginToken"
}

Logout :-

{
    "isSuccess":true,
    "message":"Logout Success",
    "type":"fbLogOut"
}

Login :-

{
    "isSuccess":true,
    "idToken":"EXXXXXQ0iSXpNGVOCMVi000ZHgXXX2dfkW4HtGLUAuuXXXQZBZBV",
    "type":"googleLoginToken"
}

Login Error :-

{
    "isSuccess":false,
    "error":"Error message for logout",
    "type":"googleLoginToken"
}

Logout :-

{
    "isSuccess":true,
    "message":"Logout Success",
    "type":"googleLogOut"
}

Logout Error:-

{
    "isSuccess":false,
    "error":"Error message for logout",
    "type":"googleLogOut"
}

Login :-

{
    "isSuccess":true,
    "idToken":"********",
    "code":"***********",
    "type":"appleLoginToken",
    *"firstName":"FirstNameHere",
    *"lastName":"LastNameHere",
    *"emailId":"support@webtonative.com"
}

  • *Apple only returns the user's information the first time the user authorizes the app. Persist this information from your app; subsequent authorization requests won’t contain this information.

  • Once you have the user’s token(idToken), you can decode it using any general-purpose JWT library to retrieve user's information.

Note:-

Apple Login is available only in iOS.

PreviousIn App Purchase - Android IntegrationNextFacebook App Events

Last updated 1 year ago

Was this helpful?

We have wordpress plugin for social login integration. Kindly find webtonative wordpress plugin from below link.

Wordpress plugin: We have wordpress plugin for social login integration. Kindly find webtonative wordpress plugin from below link.

Shopify plugin: We have shopify plugin for social login integration.

https://wordpress.org/plugins/webtonative/
https://wordpress.org/plugins/webtonative/
https://apps.shopify.com/social-login-webtonative