Skip to content

Instantly share code, notes, and snippets.

Created January 9, 2018 23:09
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/64f930f6f743c9f3de26038563a1171b to your computer and use it in GitHub Desktop.
Save anonymous/64f930f6f743c9f3de26038563a1171b to your computer and use it in GitHub Desktop.
Facebook Oauth Sample Code
********************
Facebook Oauth Sample Code ->>>
********************
http://shurll.com/bztge
(Copy & Paste link)
********************
ColdFusion / CFML OAuth2 - OAuth 2.0 Client Library for ColdFusion. ProductsFacebook LoginSharing on FacebookGamesFacebook App Ads. 404 Error .. Select Web Form and name the new item default for this example. You should see a new item called default.aspx appear under the TembooOAuth project; this is the ASP.Net web controller that we'll use to host our simple UI and code. On the other side of the if statement, we finalize the OAuth process by running the finalizeAuthentication() method that's defined in default.aspx.cs This method retrieves the CallbackID value from the "state" querystring parameter, and uses it to run the FinalizeOAuth Choreo. Create your C# web project 1 Log in to Temboo. shareimprove this answer answered Aug 28 '11 at 5:59 bkaid 40.8k1395117 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. It's back! Take the 2018 Developer Survey today . Services that support OAuth 2. Set up your Temboo callback URL by specifying the following URL as your Site URL: Note: you'll need your Facebook App ID and App Secret later, so copy them somewhere convenient. private static readonly string FACEBOOKAPPID = "YOURFACEBOOKAPPID"; private static readonly string FACEBOOKAPPSECRET = "YOURFACEBOOKAPPSECRET"; 10 Showtime! Run the web application by clicking the "Run/Debug" button in the top Visual Studio toolbar: .and browse to the following URL. private static readonly string TEMBOOACCOUNTNAME = "ACCOUNTNAME"; private static readonly string TEMBOOAPPLICATIONNAME = "APPNAME"; private static readonly string TEMBOOAPPLICATIONKEY = "APPKEY"; // Provide your Facebook App ID and App Secret. What's Next? We're all finished! This C# application executes the OAuth flow, and retrieves information about your app's user. You should be redirected to Facebook, where you can log in and grant the application access. Facebook sends OAuth information back to Temboo Temboo redirects the user back to your application, with a special "state" querystring parameter The application detects the "state" parameter, and uses its value to retrieve an OAuth Access Token Finally, the application uses the Access Token to retrieve some information about the current user from Facebook Let's see how these steps work in practice. Next, the getAuthorizationURL() method runs the InitializeOAuth Choreo. As one of its inputs, this Choreo accepts a "forwarding URL," to which the user will be sent after visiting Facebook to allow access. FinalizeOAuth finalizeOAuthChoreo = new FinalizeOAuth(session); finalizeOAuthChoreo.setAppID(FACEBOOKAPPID); finalizeOAuthChoreo.setAppSecret(FACEBOOKAPPSECRET); finalizeOAuthChoreo.setCallbackID(callbackID); // Run the Choreo, and store the Authorization Token output in a variable FinalizeOAuthResultSet finalizeOAuthResults = finalizeOAuthChoreo.execute(); FACEBOOKACCESSTOKEN = finalizeOAuthResults.AccessToken; // Instantiate the Facebook.Reading.User Choreo, and supply the Authorization Token // retrieved from the OAuth process as an input. Replace the contents of this file with: using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Temboo.Core; using Temboo.Library.Facebook.OAuth; using Temboo.Library.Facebook.Reading; namespace TembooOAuth { public partial class default : System.Web.UI.Page { // Replace with your Temboo credentials. Add the C# OAuth Code 7 Open default.aspx and edit the content of the HTML tag to read as follows: ">Click here to begin the OAuth process. CURRENTPAGELOCATION = Request.Url.AbsoluteUri; } /// Perform the first step of the OAuth handshake with Facebook, and return the /// URL to which the user should be sent to allow access to their Facebook account. In order to follow this example, you'll need the .NET 4.5 framework and Microsoft Visual Studio 2013 (or later). That's it! Taking a closer look at the code At a high level, the OAuth workflow performed by this simple application looks like this: Generate an "authorization URL" on Facebook, where users can allow access to their account, and direct the user to this location. The important part looks like: ">Click here to begin the OAuth process. Back . Register your Facebook App 6 Create a new Facebook app via the Facebook developer console using the Apps menu at the top of the page. Our simple app simply logs users in and displays some info about their Facebook profile. Java MitreID (with OpenID Connect) Apache Oltu Spring Security OAuth Apis Authorization Server (v2-31) Restlet Framework (draft 30) Apache CXF Tokens: Java library for conveniently verifying and storing OAuth 2.0 service access tokens. // For inputs we specify the Facebook App ID, the unique identifier (callback ID) for this OAuth transaction, // and the "forwarding URL" to which users will be sent after they allow access on Facebook. To start a new OAuth workflow, we run the getAuthorizationURL() method, that's defined in the code you pasted into default.aspx.cs. 3 In Visual Studio, create a new "C# ASP.Net Empty Web Application" project. Join Stack Overflow to learn, share knowledge, and build your career. This file contains the C# variables and methods that are referenced by your ASP page. osin: Golang OAuth2 server library Golang OAuth 2 Server framework gin-oauth2: middleware for Gin Framework users who also want to use OAuth2 C Glewlwyd a lightweight OAuth2 server providing JSON Web Tokens and supports authentication with database or LDAP backend for users and clients. If you don't already have an account, you can register for free 5a02188284
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment