Skip to content

Instantly share code, notes, and snippets.

Created January 9, 2018 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d7ad184cc92e30ca09683146f8c4d9bb to your computer and use it in GitHub Desktop.
Save anonymous/d7ad184cc92e30ca09683146f8c4d9bb to your computer and use it in GitHub Desktop.
Facebook Authentication Api
********************
Facebook Authentication Api ->>->>->>
********************
http://shurll.com/bz4ip
(Copy & Paste link)
********************
So the new flow looks like this. We now want to create an iPhone application for our site and also a public API for others to use our service. POST in REST3348What exactly is RESTful programming?541Understanding REST: Verbs, error codes, and authentication355Design for Facebook authentication in an iOS app that also accesses a secured web service382How to do authentication with a REST API right? (Browser + Native clients)187How to implement a secure REST API with node.js Hot Network Questions What's the biggest circle that can fit between 2 Gaussian curves? Does your ISP know what type of phone/computer you're using? Why play a fretted note while you can play it on an open string? Why did SpaceX retire Falcon 1? United Airlines joined my first name and middle name on boarding pass. var email = error.email; // The firebase.auth.AuthCredential type that was used. asked 5 years, 4 months ago viewed 30,503 times active 10 months ago Blog Take the 2018 Developer Survey Visit Chat Linked 107 If you can decode JWT how are they secure? 37 How should a Facebook user access token be consumed on the server-side? 1 REST API authentication tokens 5 How to use facebook login to access data from backend server in Android app? 8 Architecture Design - REST API to support Facebook Login done by Mobile app 0 How secure is JWT 1 Larvel 5 API authorization for mobile applications which uses Facebook for authorization 0 Using other facebook app access token 0 How to submit scores securely from app that uses only facebook login? Related 4778The definitive guide to form-based website authentication713Best Practices for securing a REST API / web service623RESTful Authentication878Best practices for API versioning?4066PUT vs. Add Firebase to your JavaScript project. var token = result.credential.accessToken; // The signed-in user info. my-app-12345.firebaseapp.com//auth/handler) is listed as one of your OAuth redirect URIs in your Facebook app's settings page on the Facebook for Developers site in the Product Settings > Facebook Login config. } // The signed-in user info. How does it sound? --- Update: July 27th, 2014 to answer question --- I only use the above exchange once upon login. var user = result.user; }).catch(function(error) { // Handle Errors here. In every call to my custom API I'll include the Facebook user id and the access token. firebase.auth().signInWithCredential(credential).catch(function(error) { // Handle Errors here. rev2018.1.8.28313 . Client: Request JWT from my API by calling /verify-access-token endpoint. var credential = firebase.auth.FacebookAuthProvider.credential(accesstoken); // Sign in with credential from the Google user. I am creating a REST API an my users only auth with Facebook connect. Join Stack Overflow to learn, share knowledge, and build your career. Join Stack Overflow to learn, share knowledge, and build your career. Once the token expiry is met, the token expires revoking access to API. Handling account-exists-with-different-credential Errors If you enabled the One account per email address setting in the Firebase console, when a user tries to sign in a to a provider (such as Facebook) with an email that already exists for another Firebase user's provider (such as Google), the error auth/account-exists-with-different-credential is thrown along with an AuthCredential object (Facebook access token). var token = result.credential.accessToken; // . developers.facebook.com/docs/opengraph/using-actions/… –DerMeister Jan 31 '14 at 10:16 If we send userid and accesstoken to the API server everytime (as post/get params). Have you read the comments in the article you mentioned? I found them really interesting and helpful. For an official application that we create, we wouldn't necessarily need to use the public API in the same way. Stack Overflow Questions Developer Jobs Tags Users current community help chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. In your apps, the recommended way to know the auth status of your user is to set an observer on the Auth object. –Drewness Jun 26 '12 at 18:53 add a comment Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. // User tries to sign in to Facebook. var errorCode = error.code; var errorMessage = error.message; // The email of the user's account used. maybe not even a correct one! But I think that would make for a good starting point. // TODO: implement getProviderForProviderId. Every token is used once 5a02188284
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment