Mar 16, 2024, 6:26 AM

How to integrate facebook login using Swayauth facebook api

Integrate facebook login on your web and mobile app, using swayauth.

Integration

To integrate facebook login / register, redirect user to Swayauth authentication url https://api.swayauth.com/v1/auth/facebook with <client_id>, which is your organisation token id, generated from the Swayauth dashboard, as the URL parameter on the link below to identify your application ie. https://api.swayauth.com/v1/auth/facebook?client_id=65da91b31c1f6515540001e1

Authentication

After a successful redirect to facebook authentication page, and authentication is completed. Swayauth will redirect back to the redirect_url provided while creating an organisation token, attached to specified redirect_url URL parameters are:

1. status: this can be true for successful authentication and false for failed authentication.

2. message: OK for successful authentication and a short message specifying what went wrong in a failed attempt.

3. intent: for this purpose intent is login 

4. access_token: user decodable jwt token

5. refresh_token: user decodable jwt token

UI modification

To remove Swayauth alert while redirecting to facebook authentication page, an alert=off can be added to URL parameter. ie https://api.swayauth.com/v1/auth/facebook?alert=off&client_id=65da91b31c1f6515540001e1

Implement Popup

To implement popup window authentication and avoid leaving authorization page, check the blog post here.

Next

How to integrate google login using Swayauth google api

Integrate google login on your web and mobile app, using swayauth

How to add social authentication popup modal on your website using Swayauth

Integrate authentication popup window that works for both desktop and mobile without leaving a page