I'm developing an Android App with an ASP.NET Wep-API Backend. Currently i have problems with the Facebook login. I want to login the users with the FB Access Token i get by the Facebook Android SDK. Is this possible? I thought i read something about that this is possible without a workarround by directly post the token to the /signin-facebook endpoint, but i can't find that solution anymore. So here is my question:
Is it possible to login/register to an ASP.NET Web-API directly with the facebook token? Or do i have to implement a workaround?
Best regards
The Web API comes with OWIN which then allowing you to implement (or activate) Access token login. You need to register to Facebook developer in order to get the app Id and secret key.
You can install in your web api project using nuget:
Install-Package Microsoft.Owin.Security.Facebook -Version 2.1.0
More detail.. you can try follow the link here
Related
I am trying to integrate Microsoft account login to my ASP.NET Core application. I have setup a microsoft application in the Microsoft Application Registration portal with the given redirect URI.
Here is a snippet from the Startup.cs file.
// Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715
app.UseMicrosoftAccountAuthentication(new MicrosoftAccountOptions()
{
// I can't post my secrets here
ClientId = "my_client_id",
ClientSecret = "my_client_secret"
});
When I run the app and login via Microsoft, I get redirected to the Microsoft Login page.
It has the following query parameters (with the id's removed)
client_id:my_client_id
scope:https://graph.microsoft.com/user.read
response_type:code
redirect_uri:https://localhost:44328/signin-microsoft
state:the_state
When I sign in with my microsoft personal account, I got redirected to an error page instead.
The URL says The+provided+value+for+the+input+parameter+'redirect_uri'+is+not+valid.+The+expected+value+is+'https://login.live.com/oauth20_desktop.srf'+or+a+URL+which+matches+the+redirect+URI+registered+for+this+client+application
I verified that my redirect URL in the microsoft app is exactly the same as the redirect url passed to the Microsoft log in page so I don't know what's the issue.
Another weird thing though if I log in using a Work or School account, I can proceed properly and it redirects me to the callback page.
Can anyone please help me on this? Thank you.
Double check if you are using latest version of authentication middleware in your project (there was few changes few week ago due to changes in MS OAuth - now v2 it's in use).
Double check if you have created app under new v2 endpoint - read more here: How to register an app with the v2.0 endpoint.
Double check if you have created password for your app on Microsoft Site.
Check Live SDK support option in 'Advenced' section - this should be enabled (at least in my case, but look like this doesn't help in your).
Here you can find more information:
Microsoft account is experiencing technical problems. Please try again later. (GitHub #827)
External login via Microsoft Account failed on RC2/RC3 (GitHub #866)
Enabling authentication using external providers
Update:
Ok, I see now - you have two things:
missing https (ssl), see this post,
different port number - it means that is different url and this is reason of your problem - you'r using different url than registered with your app:
http://localhost:54554/signin-microsoft - registred in app
https://localhost:44328/signin-microsoft - form your error message
I have the same problem.
I use Microsoft Oauth 2.0 to solve this problem. You can find MVC .net sample at https://azure.microsoft.com/en-us/documentation/articles/active-directory-appmodel-v2-overview/
I've read tons of documentation about Facebook authentication, but anything seems to work.
I've tried everything, including Facebook C# SDK, and many other options.
My application is an asp.net 4.0 web site (outside facebook).
Does anyone have an working sample?
All i need is to authenticate a user and get basic user information such as name, surname, email and picture.
Thanks in advance!
You can use http://www.dotnetopenauth.net/ which is very good. You can also use facebook api javascript library which is very easy to use. Maybe you haven't configured your application in facebook correctly. It needs callback url. Some related questions:
Facebook/ Twitter with dotnetopenauth?
DotNetOpenAuth Get Facebook Email Address
How to log in with Facebook using DotNetOpenAuth
I am developing an asp.net web application in vs2008 framework 3.5.I need to use google login and registration in my site.Please tel me whether i should use any api ?Is there any ways to extract the sign in information from the user who is using my site?
My intention is to create login like that in http://www.plaxo.com/.
You need to use OpenId, dotnetopenauth should serve your purpose.
This article, although for MVC, should explain to you how to use DotNetOpenAuth.
Hi does someone have a link or can offer some guidance on HOW the facebook C# SDK could be used to provide access credentials to facebook along side ASP.Net membership?
Basically what i would like to do is have some kind of connect button on my profile view that when clicked opens the facebook app authorization window, if the user signs in and agrees the facebook auth cookie is returned or accessible so i can store in locally in my DB.
I originally tried to figure out how to do this using dotnetopenauth about 9 months ago and eventually gave up. ANY help is appreciated. thanks!
I haven't done it, but it shouldn't be too hard I think.
I'm assuming you already know how to "authenticate" users with Facebook using the C# SDK. At that very point where you consider them "authenticated" hook into it and perhaps use FormsAuthentication.SetAuthCookie() to manually authenticate the user from the default ASP.NET membership's perspective.
we are going to develop web-application in asp .net 4.0. in this, we are using asp .net membership provider to login the application. we want to integrate facebook login with this application. user can login to this application using facebook credential and it will be authenticated in our application. Application will allow user to invite facebook friends from this web-site.
Please suggest me on this! is there any facebook API available for this or any other way.. ?
you can use this library to fully integrate your ASP.NET application with Facebook:
Facebook C# SDK
some articles to start with:
Getting Started With Facebook C# SDK
How to Retrieve User Data from Facebook Connect in ASP.NET
http://codesamplez.com/development/c-sharp-library-for-facebook-api
there is also another library called "Facebook Graph Toolkit", but I didn't use it before.
http://fgt.codeplex.com/