Abdus Sattar Bhuiyan
Abdus Sattar Bhuiyan

Reputation: 3074

Does Facebook SDK require HTTPS?

I am using facebook SDK. I am getting the following error:

Insecure Login Blocked: You can't get an access token or log in to this app from an insecure page. Try re-loading the page as https://

After studying I came to know that I have to set 'Enforce HTTPS' as NO under 'facebook login> Setting> '. But I can not set Enforce HTTPS as NO. Is this problem is from mine? OR I facebook restrict to use https instead of http?

Upvotes: 23

Views: 33344

Answers (5)

It seems like Business apps do not have app modes and instead rely exclusively on access levels. Because of this, you can't set the app to the "Development mode".

  • All newly created apps start out in Development mode and you should avoid changing it until you have completed all development and testing.

https://developers.facebook.com/docs/development/build-and-test/

https://developers.facebook.com/docs/development/build-and-test/app-modes

However, if you wanna try out your app in a localhost, you need to create a test app, like you can check out in this thread:

How to fix 'Facebook has detected MyApp isn't using a secure connection to transfer information.' error in Laravel

Upvotes: 0

Travis Yu
Travis Yu

Reputation: 201

enable Client OAuth Login and write "localhost:3000" in Valid OAuth Redirect URIs.
Save changes. it will automatically change to https://localhost:3000 , but it doesn't matter...
And set Status: In Development (THIS IS IMPORTANT!)
Then it will work in your http localhost.

Upvotes: 20

bsmk
bsmk

Reputation: 1347

If you just enable Client OAuth Login and write just localhost:{port} to Valid OAuth Redirect URIs, it will work.

Upvotes: 8

fisch2
fisch2

Reputation: 2753

If you're developing locally with create-react-app, a quick solution is to add

HTTPS=true

to your .env file and just comment it out when you're not testing Facebook login.

Upvotes: 2

C3roe
C3roe

Reputation: 96250

But I can not set Enforce HTTPS as NO. Is this problem is from mine?

https://developers.facebook.com/docs/facebook-login/security:

Enforce HTTPS. This setting requires HTTPS for OAuth Redirects and pages getting access tokens with the JavaScript SDK. All new apps created as of March 2018 have this setting on by default and you should plan to migrate any existing apps to use only HTTPS URLs by March 2019.

Sounds to me, like they don’t want you to be able to even start without HTTPS, when you are creating a new app now.


Plus, Chrome has recently announced that they will mark all HTTP sites as insecure soon, from version 68 on, that will be released in July 2018. So you’re gonna have to go HTTPS rather sooner than later anyway.

The “big players” of the industry are currently pushing for this big time, whether we want it or not.

Upvotes: 8

Related Questions