social-app-django icon indicating copy to clipboard operation
social-app-django copied to clipboard

Can't Load URL with Strict Mode for Redirect URIs in FB

Open unixeO opened this issue 8 years ago • 39 comments

Facebook has default the Strict Mode for Redirect URIs, so now it's impossible to login with an url like this one:

http://<domain>/social-auth/complete/facebook/?redirect_state=<token>

Is there a walk around to fix this issue?

Also try to set the Valid OAuth redirect URIs in the facebook developer dashboard in this mode:

http://<domain>/complete/facebook/&client_id=<client_id>&return_scopes=true,
http://<domain>/social-auth/complete/facebook/?redirect_state=<>

Proposal from here: https://github.com/python-social-auth/social-app-django/issues/112

But didn't work!

Is there a correct way to set up the Valid OAuth redirect URIs?

unixeO avatar Mar 19 '18 02:03 unixeO

Today my auth has stopped working, mmmm nice :)

Is it related to this issue ?

Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.

ArtemBernatskyy avatar Mar 19 '18 10:03 ArtemBernatskyy

Indeed @ArtemBernatskyy! One of the causes of the message: Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings. is because of this issue.

unixeO avatar Mar 19 '18 16:03 unixeO

I assume the facebook backend has all these parameters for legacy reasons? With the state parameter you should be able to track whatever you need...

dmwyatt avatar Mar 19 '18 17:03 dmwyatt

I think the FacebookOAuth2 class needs STATE_PARAMETER = False.

paltman avatar Mar 20 '18 01:03 paltman

that removes the state parameter from the redirect uri but it's still failing


Noticing the error message complain about App Domain I try adding localhost:8000 and localhost but get different errors for both.

paltman avatar Mar 20 '18 01:03 paltman

Faced same problem. Did somebody solved it?

DmitryNoven avatar Mar 28 '18 10:03 DmitryNoven

Any solution guys?

slimaidarismail avatar Mar 28 '18 10:03 slimaidarismail

We're facing the same issue. Any luck @paltman ?

gusreyes01 avatar Mar 28 '18 18:03 gusreyes01

Not yet. I'm coming back to it today after some time away hoping to have found someone fixed it by now. :)

paltman avatar Mar 30 '18 18:03 paltman

I think it's a url encoding issue

paltman avatar Mar 31 '18 17:03 paltman

No, Facebook specifically disabled the ability to have url parameters other than state.

On Sat, Mar 31, 2018, 12:02 PM Patrick Altman [email protected] wrote:

I think it's a url encoding issue

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/python-social-auth/social-app-django/issues/130#issuecomment-377707636, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJ-H0Un9nsDC9k_GwPg6z6skZm2EM-wks5tj7aLgaJpZM4SvgCs .

-- Dustin

dmwyatt avatar Mar 31 '18 19:03 dmwyatt

i'm only sending redirect_uri

paltman avatar Mar 31 '18 20:03 paltman

Also, when I urlencode the contents of the redirect_uri, the redirect happens

paltman avatar Mar 31 '18 20:03 paltman

I'm an idiot.

I was including extra params in my whitelisted url. Setting to just http://localhost:8000/account/social/complete/facebook/ work.

paltman avatar Mar 31 '18 20:03 paltman

@paltman can you create pull request with fix for that ?

ArtemBernatskyy avatar Mar 31 '18 20:03 ArtemBernatskyy

i was planning to be ended up with zero changes. i was just adding the wrong string for the redirect url

Sent from my iPhone

On Mar 31, 2018, at 3:59 PM, Artem.Bernatskyy [email protected] wrote:

@paltman can you create pull request with fix for that ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

paltman avatar Mar 31 '18 21:03 paltman

Following @paltman comment I just add "https://{my_domain}/complete/facebook/" to Valid OAuth Redirect URIs and it worked.

ediazpacheco avatar Mar 31 '18 21:03 ediazpacheco

from social_core.backends.facebook import FacebookOAuth2


class CustomFacebookOauth(FacebookOAuth2):
    REDIRECT_STATE = False

and in settings.py: change social_core.backends.facebook.FacebookOAuth2 on your CustomFacebookOauth in AUTHENTICATION_BACKENDS

White list must not contain query params. Just {domain}/auth/social/complete/facebook/ Helped for me.

DmitryNoven avatar Apr 04 '18 09:04 DmitryNoven

Can anyone help me? The fb login url in mysite is: https://<my_domain>/oauth/login/facebook/ And I add this url in fb oauth redirect: https://<my_domain>/oauth/complete/facebook/

Then it returned: Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.

I am sure I've added <my_domain> in the App Domains field in fb console. This confuses my a lot, thank you guys.

arthur55 avatar Apr 04 '18 13:04 arthur55

Can somebody post fully fledged tutorial how to fix that ? Thx

ArtemBernatskyy avatar Apr 04 '18 18:04 ArtemBernatskyy