How do I connect to Facebook from an ASP.NET webservice? - asp.net

I want to create a webservice that allows user to connect to Facebook. In my webservice, there is a method named "connect" which requires 2 parameters: the username and password (of the Facebook account).
I have to use this username and password to connect to Facebook from the webservice. After that, I want to allow the user to post on their walls...Is is it possible to connect to Facebook using a webservice?
I tried a lot, and I can login to Facebook account, but I can't get the sessionkey and userid.
How can I integrate Facebook in an ASP.NET webservice?
Please help me to resolve this issue.

Facebook Connect Authentication for ASP.NET is a component that allows ASP.NET web developers to identify and validate users accessing their website or web services using Facebook Connect.
It is written in C#, targeted at .NET 2.0.
http://fbconnectauth.codeplex.com/

You can also use this Tutorial to authenticate the users in ASP.NET application
http://devtacular.com/articles/bkonrad/how-to-retrieve-user-data-from-facebook-connect-in-aspnet/

Related

Custom authentication on IdentityServer4

I'm digging into building an identity server using IdentityServer4, and I have some business logic that i want to implement on password change, and on password persist.
On the asp.net core page built into the IdentityServer that I've made using the startups, I can achieve it on the controllers provided, ok.
But, I wanted to be able to change the password check for a token grant to a windows client or mobile client for example,these clients won't do the login from the asp.net page.
How can I acheive this?

Authentication with oAuth and ASP.NET MVC + WebApi

We are planning to start developing our new site with ASP.Net, MVC and AngularJS. I will also have a WebApi that i would like to use oAuth authentication with, because it is easy to to pass in token, plus may want to allow users to login with Google, Facebook etc in the future.
Questions
If i want to use oAuth on my WebApi (which is a separate application), what authentication method should i be using for my asp.net MVC website? oAuth? Forms? Both? And how do you implement this? On my API i wrote a simple oAuth provider that asks for a username and password and returns a token string.
Should my WebApi have a single sign on login page to interact with the website? Or should the login page be on the website? Should the login page use client side calls or server side calls?
What is actually within the oAuth token and how does it link to my website? Do I have to do something on the server once they login via Facebook/Google? Can I use this token on my server to determine which user is logged in?
Our website has many databases, all the same, but depending which user is logging in, depends on which database they can view data from. Is this easy to cope with using standard method/objects in ASP.Net MVC? Or is this going to force me in writing my own code?
Any advice would be appreciated as well!
If are you planning to use MVC 5 You could use Asp.Net Identity.
Take a look here: http://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on
I hope this could help you.
Diego
Your best bet :
This topic shows how to secure a web API using OAuth2 to authenticate
against a membership database for both local and social login
http://www.asp.net/web-api/overview/security/individual-accounts-in-web-api

SSO between Sharepoint & Asp.Net MVC3

I have a Sharepoint Site(am not the SP expert) where user logs in this is form based authentication model where Username password is stored in a db...now when user clicks on a link i want him to redirect to a MVC3 application. While doing so i want user tobe autmatically signed in to MVC application. What is the best way to implement that.
Thanks
One way is to pass authentication token in the http header from SharePoint to other web application. Then, MVC application should validate the token before accessing the web site.

ASP.Net Mvc 3 webservice repository authentication

We are starting with a new application build with Asp.net. It should connect to a webservice which is already available to retrieve data to present to the user. We've created a repository which communicates with the webservice.
The webservice needs authorization with the same user credentials which the user uses to logon to the web application. The user is authorized with Forms Authentication with cookie support.
The problem is that we cannot retrieve the password from the user on new requests when the user is once authorized and automatically logged on. This password is needed to logon to the webservice from the repository classes.
Any ideas on how to implement this the best and safest way ?
You can try using Client Application Services to get and set the cookie. Or you can manually get and set the cookie using the sample code on this post. The example shows both methods and is geared specifically to passing a forms authentication cookie from an MVC application to an OData WCF feed:
http://blogs.msdn.com/b/astoriateam/archive/2010/07/21/odata-and-authentication-part-7-forms-authentication.aspx
Also, here is a similar example that is trimmed down in scope:
http://www.codeproject.com/Articles/190806/Send-Cookies-When-Making-WCF-Service-Calls

Get the user's name and email from OpenID Logged In Username

I am using OpenID with Google to login into my web page. I want to retrieve the email and user's first and last names to know who is logging in to my web page.
see here for an example about Integrating OpenID in an ASP.NET MVC Application using DotNetOpenAuth

Resources