Facebook Login for Windows Phone - facebook

I need some help regarding issues in Logging In to my App using the process described in the following link-
https://developers.facebook.com/docs/facebook-login/login-for-windows-phone/
Its the new way of logging in using the Facebook app for windows phone.
So following the guide, here's what I have been able to accomplish -
Prepare the fb app by entering the Product id
Invoking the Login dialog by launching the Uri as follows -
fbconnect://authorize?client_id={your-facebook-app-id}&scope={permissions-requested}&redirect_uri=msft-{ProductID}://authorize
The fb app opens and asks my app on fb for access to basic info and friends list.
I / User grants the required permissions.
My app on windows phone opens again - the problem is here.
The FB app should open my app by requesting a uri - as described in the "Before You Start" section in the above link.
I have setup my app to register for uri association as described here -
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206987%28v=vs.105%29.aspx
I have done this step correctly - I checked this by creating another app and launching my app through Uri association. Its as follows -
Uri uriToLaunch = new Uri("my-app-id:fblogin?access_token=12345678",
UriKind.RelativeOrAbsolute);
Windows.System.Launcher.LaunchUriAsync(uriToLaunch);
I get the access token by the above method.
But this does not happen through the fb app.
So is my understanding of the process of logging in using fb correct??
If so, what might I be doing wrong? if not, then what am I doing wrong??
all help is greatly appreciated.
thank you
SOLUTION:-
I setup wrong Uri association. It must be as follows -
<Protocol Name="msft-43245dd584d84cde837aa19a4a2e3914" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
In the "Name" field, it must be like msft-{Your-ProductID-Here}

This login flow will work only on phones which have beta version of facebook installed on them . So it wont be advisable to use this method for login. Still theres an article that describes how you can implement facebook login using Uri association. Link

Related

Using Facebook Authentication

In my Angular2 app I have used the following code:
loginfb() {
this.afAuth.auth.signInWithPopup(new firebase.auth.FacebookAuthProvider());
}
But the problem is I am getting an error App Not Set Up: This app is still in development mode, and you don't have access to it. Switch to a registered test user or ask an app admin for permissions.
So I went to Facebook developers, created an app, added the Facebook Login product, went to the product's settings and set the Valid OAuth redirect URIs with the URI given in the firebase console.
But even then when I am trying to login, I am facing the same error.
Any help would be greatly appreciated. Thanks.
This error comes when your app is not live.There are a bunch of possible things which could trigger this error.I am not sure and as you are getting error "you don't have access to it",may be you are trying to login through your test version of the Facebook app and you may have not added the user Roles as Testers in Roles section and the you have to add the email address of the Facebook account you are trying to login in setting section.
Then ,make sure that the user you added accepts the request sent before you try to test otherwise it will fail.
And for error "Switch to a registered test user or ask an app admin for permissions."
When you create new app on Facebook, its by default only visible to you and not to public and others won't be able to use it for social login and they will get this error. You may have to go to Go to your Facebook app's dashboard, Select the "Status and Review" tab and set YES or ON.
You can find similar question and answer is there in this link App Not Set Up.and
This app is still in development mode

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

Windows Phone Facebook app not returning access token after V 8.3.1.0 Update

I allow my windows phone app users to login using their Facebook account. To authenticate the user and get the access token, I follow the steps provided in this link. It opens up the installed Facebook app on windows phone, authenticates the user and returns an access token. This was working until Facebook recevied V 8.3.1.0 update. Now it opens up the facebook app and comes back with following error:
/Protocol?encodedLaunchUri=msft-<my_app_id>://authorize?error=&error_code=2005&error_description=Calling+app's+ID+doesn't+match+the+ID+sent+by+the+calling+app&error_reason=Calling+app's+ID+doesn't+match+the+ID+sent+by+the+calling+app&state="
What went wrong here? Any deep link changes by facebook?
Found a solution.
When we create a Windows Phone project in Visual Studio, it would assign a Product Id to our app. That Id will change once the app is published on the store.
When we define custom Uri scheme in WMAppManifest.xml file, we have to always specify the published app id. Otherwise facebook authentication would fail.
This new facebook app is expecting the calling app's product id to be same as published app id that is mentioned in the custom uri scheme. Since it won't match in our local app, it is returning the error stated above. I changed the Product id to published app id and everything works fine.
This might help if someone is facing similar issue.

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

facebook login without dialog in wp7

Several WP7 apps (like the official FB application) provide their own login dialog and after filling it you get connected to facebook.
Further you are automatically logged in when you call the application later.
In general it's no problem to store the credentials encrypted on the device.
My question - has anyone an idea how to achive what the "offical FB app" does?
I searche around - but found nothing more then "must use the dialog / there is no other way...".
But for sure there is a way - since apps do this.
The "official fb app" also requires authentication.
the "Built in facebook support" works by connecting your LiveID to your facebook, and you still gave it your credentails when you connected it the first time.
There is nothing that exposes the "built in" credentials for any of the accounts (twitter, linked in, etc)
Can you imagine what would happen if ANY app could just automatically log in to any of those apps and do whatever they want?