Facebook Login on local host . http local host not working - javascript

I am building an project for which i require facebook login. I have created an app on facebook for developers and have followed all instructions and tutorial for it. Now when i call api. it is giving an error show in below image.
i have referred to this answer Working with Facebook login from localhost
and this one also
facebook login on localhost without https
using these two answers i have created an test app from original app on facebook but still cant toggle enforce https option
Is there any other way or any update on previous answers?

Related

How to permit facebook login by all pages and subdomains of the app?

I have many pages with subdomais by example: customer1.example.com, customer2.example.com, and i need to login users in all this domains and this subdomains are generated dynamically. In some point this used to work, but something is altered in facebook dashboard and this stopped to work.
I put oauth redirect and app domain to maindomain i tried other solutions like that Facebook App on Subdomains: Site URL vs App Domains. In this one says that is not possible Facebook login from App subdomain not working, but last week this worked fine for us, i just need to discover what i need to do to correct that.
EDIT: When i try what tells in last post it works, but i have so many domains and they are generated automatically, making not so easy to maintain that.

Facebook Api to post use submitted image to a specific page

Here is what I am trying to achieve - I want to take input from my users as some text and image and post it to a page created by me. The user using the mobile app , does not have any any access to that facebook page. I want to post to that page anonymously on behalf of the user. The page is created by me so I should have access to it. I am really confused what to look for. I have set up an app in facebook developer from the same account who is the creator of the page and I can login user's and have their access token.By the way, if it's relevant I am building a hybrid app and using cordova facebook native plugin
This is the API call you need, there are code examples for several languages: https://developers.facebook.com/docs/graph-api/reference/page/feed#publish
Take a look at the code for the JavaScript SDK, just use that API endpoint with the correct parameters in your cordova plugin.
You need to use a Page Token with the manage_pages and publish_pages permissions. More information about Tokens:
http://www.devils-heaven.com/facebook-access-tokens/
https://developers.facebook.com/docs/facebook-login/access-tokens/

Azure AD authentication on Windows App using pure JavaScript

I'm working on a windows app using pure JavaScript and try to use AAD for authentication. The issue that I'm facing is aftering calling the "login" function from adal.js which will redirect user to the login page, how shall the app receive the response assuming the user logged in successfully? The page that I'm seeing now after login is saying"This page cannot be displayed. Make sure the web address https://login.microsoftonline.com is correct." I have entered the redirectURI value in azure with the one starting with "ms-app://s-1-15-***".
I've gone through the examples from the AAD developer's guide and I don't see examples of windows app + pure JavaScript. The "Windows Universal" section has example of C# and the "JavaScript" section is for web page application.
As adal for js is designed for web application, the redirect_url parameter requires a web server host location. So the using plain javascript to integrate adal for js is not so suitable in this scenario.
You can try to follow several workarounds:
To use C# lib in your UWP application.
To use Azure Mobile Apps' Authentication feature to authenticate & authorize your users. On sever side, you can refer to https://learn.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-windows-store-dotnet-get-started-users. And on your UWP side, you can refer to https://yorkporc.wordpress.com/2014/06/07/winjs-windows-store-app-and-aad-sso-experience-i-e-save-cookies-from-microsoftonlineaad-login-pages/ for similar usage.
Any further concern, please feel free to let me know.
I finally figured out how to perform the AAD authentication in windows app using javascript. So there's the WebAuthenticationBorker from WinRT that can be utilized for the authentication through the OAuth2 endpoint.
A link here is a very helpful example.

Sharing session between two node apps using SSO

I have an existing website which is built using express and node.js , I have to incorporate nodebb forum in that website which is again a different node application, I am using facebook login for both of them but I have to login into them seperately one by one(using same facebook app for both). What I want to do is,
1.Login via fb or any sso in the main site and the user should be logged in the forum via the same automatically.
2.How can I integrate nodebb in my website so that the look and feel doesn't change, it looks like I am on a completely different website, just need some tips to integrate nodebb in my existing website.
How can I achieve these two?
(Hey there #Vipul, NodeBB dev here) When you establish the express session your app, what are you setting the cookie's domain to?
;domain=domain (e.g., 'example.com', '.example.com' (includes all subdomains), 'subdomain.example.com') If not specified, defaults to the host portion of the current document location.
-- MDN
You'll probably want to set it to .your-domain.com, and likewise for NodeBB (do it in the "Settings/Advanced" section):
Then also make sure the key in your app is set to express.sid, which is the value we use, and that the secrets match.

Using Facebook API in widget

I'm building a widget that can be placed on a various sites, and will have users be able to log in via facebook connect to accounts on the widget's parent site. I was going to use the Facebook JS SDK to do this, but the widget will likely be placed on sites that already have the FB JS SDK initialized on them with a different app ID, and if I were to run code this way it could lead to a namespace problem.
The only current solution I have come up with is to do the server-side type authorization, and have a redirect-url that leads back to the current page in which the widget is hosted and use the state paremeter to alert backbone router that the user has logged in.
The first problem I thought of is that on the facebook docs site it says
For security, the redirect_uri must have the same base domain as that specified in the App Domain property of your app's settings, or be a URL of the form https://apps.facebook.com/YOUR_APP_NAMESPACE.
How do I bring people back to the original page that the widget it hosted on after login? Is there a better approach to this problem?
you can use Server side authentication and redirect_uri to your site that will redirect to the various site
redirect_uri = https://www.mydomain.com/?r=https%3A%2F%2Fwww.somesite.me
On you server you will look of the query param r and redirect the request to r value.
You can also do your own authentication for users (when they first sign in) and store there facebook access_token on you DB, once your widget is running (under https) and you identified the user on your authentication you can send the widget client the user's access_token and work with it.
You can even create your own Simple FB-like ajax library, for most things it will be a simple get/post/put calls with access_token as a url parameter
Hopes it helps

Categories

Resources