Facebook Connect How to get userId after sign in from face book connect - facebook

i am using facebook connect it is working fine but what i want now is i want to get the information of the currently logged in user. like name, email etc. I am working in asp.net 2.0
Regards

I woud suggest using the following project, to communicate with the facebook API:
http://facebooktoolkit.codeplex.com/Wikipage
The following page explains how to setup the project in Visual Studio and also shows how to create a Facebook session and retrieve the user info:
http://facebook.claritycon.com/help/html/64e3dc97-5125-541e-9e84-7f9303e95f06.htm

Related

Has anyone actually got ASP.NET MVC 5 Identity Facebook logins to work out of the box? (loginInfo always returns null)

Using Visual Studio 2013 Update 5, I have created a boilerplate MVC 5 application with Individual User Accounts auth option selected, and I have been trying to implement social logins using the template code, but have been unsuccessful.
I have ensured all NuGet packages are up to date, and the code is using MVC 5.2.3; Owin 3.0.1; AspNet.Identity 2.0.0.
I can get everything working fine, including authenticator apps using OtpSharp, but the Facebook login is just not working whatever I try.
I have created the Facebook App, set all the relevant options on that and set the AppId and AppSecret in my Startup.Auth.cs file.
When I try to login with Facebook, the MVC site redirects me to Facebook, which prompts me with the auth screen for the app. I click OK and accept this then I am redirected back to the MVC app. If I check the authorised apps under my Facebook account, my app is listed and shows that it has granted permission to the app to retrieve email address.
The callback works fine but when it hits ExternalLoginCallback and in particular:
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync()
loginInfo always returns null.
Looking at the Request it shows an error of access_denied:
https://localhost:44301/Account/ExternalLoginCallback?ReturnUrl=%2Fmanage&error=access_denied
I have read pretty much every blog post and SO question on this error and whilst most of them are helpful, most are also out of date and not relevant.
It would seem that something is missing from the templated project, or something has changed elsewhere as no matter which tutorial I read, and options I set, the result is the same.
I have tried this internally on a dev machine running IIS Express and externally on a hosted machine running IIS 7.5 too and the results are the same.
I've even decompiled the Microsoft.Owin.Security.Facebook library to see where that particular section of the querystring is set to no help.
If I had any hair I'd have pulled it all out by now.
I'll take any suggestions. Can anyone help?
Facebook loves to make things difficult. Access_denied sounds like they are blocking you on purpose. Check your developer dashboard and the accounts authorized to test your app while its in development mode. The email permission is approved by default, so that isn't your issue.
Make sure the account you are testing with is added here:
If that doesnt solve it, make sure you have the correct app domains (testing and live) listed in the domain section here:
I had the exact same issue. No matter what I did the facebook would show the login, get permissions and then return back to the Login page instead of the Email confirmation page.
Using Fiddler Facebook would invoke "http://localhost:1234/signin-facebook&code=SOME_SECRET_CODE_HERE", and then my application's controller would invoke "http://localhost:1234/ExternalLoginCallback?error=access_denied". I was sure Facebook is refusing the access. It was only after implementing a Facebook Javascript SDK Sample, I realised I could successfully login and also view FB scopes!
My Dev environment
MVC 5 application
Visual Studio 2013 Community edition Update 5
Microsoft.OWIN v2.2.1
Microsoft.OWIN.Security.Facebook v3.0.1
Finally I found a YouTube Video by ProCoder which mentioned to put the correct path in the Valid OAuth redirect URIs as http://localhost:1234/signin-facebook and it worked. If you haven't already added, you will need to add Facebook Login product to your Facebook app.
I also set App Domain to localhost and Site URL to http://localhost:1234/
I have added 127.0.0.1 and MY.EXTERNAL.PUBLIC.IP to the Server IP Whitelist Under Security in the Advanced Settings option of the Facebook app.
All these settings I replicated in a new MVC 5 application and it worked like a charm.
update the package Owin.Security.Facebook 3.0.1 to 3.1.0
It works for me

Facebook Test User unable to access my web page

I am trying to test the Facebook login feature for a website staging environment, but when logging in with a test user I see this error message:
Error
User is not allowed to see the application.: The user is not allowed to see this application per the developer set configuration.
I have set App Domain to http://www.mysite-stage.com/. I've also added a Website platform for my app and set the site URL to http://www.mysite-stage.com/.
The website http://www.mysite-stage.com is actually accessible to everybody on the web, so there should be no issues there.
This method of testing Facebook integration for the site was working up to about 1-2 months ago, so I'm a little confused as to why it's not working anymore.
Are you sure you created the test user for that application?
Facebook won't let you login as a test user that was created under a different app than the one you are trying to sign in with.
Facebook test users are app-specific.
Yo can also create test users through the facebook developers site:
http://developers.facebook.com/apps/
- Select your app
- Roles
- Test Users
Since I can't add a comment yet, the problem is with you having made your app available to the public but you are trying to sign in with a test account.
Have you tried using the
installed=true
parameter once you use
POST /{app-id}/accounts/test-users
to create the Test Users? See https://developers.facebook.com/docs/graph-api/reference/app/accounts/test-users#publish

Using windows azure authetication for mobile services

I making windows phone apps and i find out that windows azure have "identity" feature to authenticate user and getting userID,
what i want to know is:
can i use this userID to identify each user that login? (my app allow user to post a comment into the app and i looking for using this userID for tracking each user comment)
can i retrieve other data beside userID? like display name or picture and is it same like using their native sdk? (facebook or twitter)? to post into timeline?
My first approach is trying to integrate microsoft account but i don't know where to get client id and client secret
sorry for many question, i just getting very confuse about this... and after hours of watching channel9 and reading i just barely understand any of this...
have a look at the following blog posts using Azure Mobile Services and see if it helps you:
Getting user information on Azure Mobile Services
Enhanced users feature in Azure Mobile Services

how to post data on salesforce database from iphone application?

I am developing one iPhone application in which I want to post data on the salesforce database.
I have tried from google but not got any success.
Can you please guide me?
Thanks in Advance
Salesforce provides an iOS SDK to talk to their API:
https://github.com/forcedotcom/SalesforceMobileSDK-iOS
Here is a tutorial on getting started:
http://wiki.developerforce.com/page/Getting_Started_with_the_Mobile_SDK_for_iOS
You will need to use an Oauth flow to authenticate to the API. This means you show a Login page from Salesforce.com, the user logs in, and then your UIWebView will get a redirect with a sessionId in the URL. You can extract the sessionId and use it to talk to the API for read or write access, depending on the user's permissions. The SDK includes sample code that implements all of that, so you just need to merge that code in with your app.

Facebook Connect Using C# ASP.net

Hi i want to develop an Facebook Connect application on my Website using C#.net which will retrieve all my Friends Birthday List from my Facebook account & post it on my Website. Similar to what www.gifts.com is having. Request anyone to share a Sample Code or any idea for the same.
Take a look at the Facebook c# SDK it should be able to get you going in the right direction. It is available via NuGet if you are using Visual Studio.