Giter Club home page Giter Club logo

vindpro's Introduction

Firebase & Xamarin Authentication Sample

Facebook & LinkedIn login with Firebase and Xamarin

Facebook Auth LinkedIn Auth

To start with have an account with firebase it’s best to have an account with google cloud to get access to google cloud control and then to firebase.

Go ahead and create/import your android app project and get “google-services.json” folks who do not know what it is you have lot to catch. Replace the Json file of your own!

My Project has a sample “google-services.json” file copied from FirebaseAuthQuickStart example -have a look at this url to have the basic clear https://components.xamarin.com/gettingstarted/firebase-auth.

FirebaseAuthQuickStart sample already has google sign in implemented with firebase.

Firebase has few major authentication providers which are managed identity provider through firebase but so far Instagram, LinkedIn has not been included which are unmanaged identity providers and can be maintained by firebase with the use of custom firebase token. When you have decided to use firebase to manage app users and broker authentication it’s better if we can manage unmanaged authentication providers too with firebase

The source code will provide a best practice to follow while implementing Facebook sign in with firebase -implemented with Xamarin Facebook sdk and Firebase sdk.

As well as a way to maintain LinkedIn users with firebase with xamarin.auth and firebase sdk. Both of the implementation has different flavors for managed authentication providers like google and Facebook respective auth sdk will handle the heavy lifting- like in case of Facebook -specific activity should implement IFacebookCallback (Xamarin.Facebook) and IOnCompleteListener (Android.Gms.Tasks) and then firebase sdk will do the rest it has to use “AuthStateChanged” to check if an user logged in or not and handle the Facebook access token just like following simple example once a authentication credential is created it will make an entry to firebase table.

Facebook Access Token

But in case of LinkedIn its simple oAuth2 implementation complexity lies in creating the custom firebase token.

I have kept the token creation process in a separate shared project with a single class “Firebasetoken” make sure you have shared project template installed in your visual studio.

Remember this is just an example of how to do it – do not include this code or implement this at client side it involves a service account and other secrets which are potential security variabilities this supposed to be implemented at server end.

Following are the steps to follow. In the Firebase console click the setting icon which is top left, next to the project name, and click 'Permissions'.

Firebase Console

At the IAM and Admin page, click 'Service Accounts' on the left Click 'Create Service Account' at the top, enter a 'Service Account Name', select 'Project->Editor' in the Role selection, tick the 'Furnish a new private key' checkbox and select JSON. Click 'Create' and download the Service Account JSON file and keep it safe. Open the Service Account JSON file in a suitable text editor and put the values into Firebasetoken class

Firebase Token

Remember to include BouncyCastle reference, In fact, here is a screenshot of the references you require to build this project correctly

References

vindpro's People

Contributors

amartyamandal avatar

Watchers

James Cloos avatar Joshua Taehyun Kim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.