Overview

Social Login API.

Introduction

When building an app with Appery.io, you can use social networks to authenticate users. This can be handy: if your app requires registration, instead of providing new credentials, the user can log in with a social network. For now, the following OAuth providers are supported:

  • Twitter
  • Facebook
  • Google

First, you should create your app on the OAuth provider side.

When your app is created, use the provided credentials to configure the connection under database settings: go to Database > Your database > Social connections, turn the toggle on for the needed social network, and specify the needed credentials.

When a user logs in via a social network, a new user will be created in Users collection of the Appery.io database. Appery.io X-Appery-Session-Token will be returned for further API calls.

📘

Invoking Social Network API.

Returned token doesn’t allows to trigger social network providers API. It’s only valid for Appery.io API calls, for example, the Database REST API. In other words, you won't be able to invoke a Facebook API to get a list of your friends. In order to do this, you will need to setup a standard Facebook login functionality.

Method Summary

Social network login API has the following methods:

Method

Description

getToken

Returns Appery.io database token.

getUserId

Returns Appery.io database user id.

getStatus

Returns current authentication status.

setDefaultDB

Sets default database id.

createUser

Creates user in Appery.io database.

login

Receives Appery.io database token.

logout

Invalidates token in Appery.io database.

findUsers

Returns list of users in Appery.io database.

isLogged

Checks if Appery.io database token is valid.

updateUser

Updates Appery.io database user.

invalidate

Deletes Appery.io database token. Doesn’t invalidates token in Appery.io database.

logoutOauth

Removes social id from Appery.io database.

loginTwitter

Logging in via Twitter.

loginFB

Logging in via Facebook.

loginGoogle

Logging in via Google.