Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook auth failed #339

Closed
M77mdsD opened this issue May 15, 2023 · 13 comments
Closed

Facebook auth failed #339

M77mdsD opened this issue May 15, 2023 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@M77mdsD
Copy link

M77mdsD commented May 15, 2023

Describe the bug
Trying to use Firebase.Auth.get_auth_localhost(Firebase.Auth.get_FacebookProvider()) to login using Facebook but it doesn't work.

Expected behavior
Firebase.Auth.get_auth_localhost(Firebase.Auth.get_FacebookProvider()) Should open a working page to login (this part works) but after that, I get redirected to http://localhost:5000/ with the error "localhost refused to connect." Also, sometimes it works but I get an error message in Godot.

Screenshots
bandicam 2023-05-16 01-31-15-565
bandicam 2023-05-16 02-54-59-114

Environment:

  • OS: [Windows 11]
  • Browser [e.g. chrome]
  • Godot Version: 3.x (?)

Additional context
The login screen opens but after that, the redirect link doesn't work (the profile doesn't get registered in The Firebase users).
Did I miss a setting somewhere?

@M77mdsD M77mdsD added the bug Something isn't working label May 15, 2023
@M77mdsD M77mdsD changed the title Facebook Login auth failed Facebook auth failed May 15, 2023
@fenix-hub fenix-hub self-assigned this May 16, 2023
@fenix-hub

This comment was marked as resolved.

@fenix-hub
Copy link
Collaborator

Ignore the previous message, inspecting the screenshot looks like everything should be configured fine.
Could you set a breakpoint on line 291 and share the auth variable content?
Otherwise just print it before line 291, though a breakpoint could be more useufl.

@M77mdsD
Copy link
Author

M77mdsD commented May 16, 2023

I printed auth before the breakpoint and it is an empty dictionary.
To make it clear, logging in using Google works fine. This issue happens only with Facebook login.

@fenix-hub
Copy link
Collaborator

Oh so that's why. I'm expecting auth to not be empty since it should contain the Facebook access token.
Could you please put a breakpoint here L403 and check the content of the json result?

@M77mdsD
Copy link
Author

M77mdsD commented May 17, 2023

I putted a breakpoint in L400 and a response_code = 400 and the json results was an error:

"message": Invalid verification code format.
"type": OAuthException.
"code": 100.
"fbtrace_id": As#####################.

@fenix-hub
Copy link
Collaborator

I'm testing and cannot reproduce the error.
Are you sure you are running using the version on main branch?
Are the facebook id and secret the correct ones?

@M77mdsD
Copy link
Author

M77mdsD commented May 17, 2023

Yeah, can it be something in the Facebook app itself? Is there somewhere that shows how to set up the Facebook app page? Should I use a test app or a normal app?

@fenix-hub
Copy link
Collaborator

We don't have our "official" guide yet, but basically you can just follow this article since 99% of the stuff that should be configured is not specifically related to our plugin, but general Firebase and OAuth2 flow. 👉 guide
The only thing you need to do in your project is to set up the facebook_id and facebook_secret in your godot-firebase/.env file like this

[firebase/environment_variables]
apiKey="xxx"
authDomain="xxx"
databaseURL="xxx"
projectId="xxx"
...

[firebase/auth_providers]
facebook_id="xxx"
facebook_secret="xxx"

And everything should just work fine.
Of course feel free to reach us out on discord to get some help.

@phil-hudson
Copy link

Instead of hitting localhost, what happens if you change it to 127.0.0.1?

I'm having issues where my firebase emulator cannot be resolved from godot, and changing the GodotFirebase code from localhost to 127.0.0.1 made it work for me.

@fenix-hub
Copy link
Collaborator

Instead of hitting localhost, what happens if you change it to 127.0.0.1?

I'm having issues where my firebase emulator cannot be resolved from godot, and changing the GodotFirebase code from localhost to 127.0.0.1 made it work for me.

If it works for you, that's ok. There's should me no issue about changing from localhost to 127.0.0.1.
Eventually your hosts file doesn't map 127.0.0.1 to localhost, or Godot is unable to resolve it.

@phil-hudson
Copy link

Correct, it needs to be mapped in hosts correctly. I just wondered if the user might be having the same issue.

@fenix-hub
Copy link
Collaborator

Correct, it needs to be mapped in hosts correctly. I just wondered if the user might be having the same issue.

As it happened for you, there might be a chance a user may have the same issue, even if very low.

@WolfgangSenff
Copy link
Collaborator

There's something much bigger here. The entire OAuth2 flow is fully broken now due to deprecations on the Firebase side, removing the loopback URLs in addition to the original URL style. I'm actually going to close this, and when I have a moment, open an entirely new bug to track the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants