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

FunctionClauseError: no function clause matching in Ueberauth.Strategy.Twitter.OAuth.access_token/3 #37

Open
Awlexus opened this issue Mar 25, 2020 · 2 comments

Comments

@Awlexus
Copy link

Awlexus commented Mar 25, 2020

We've been receving lots of errors like the following one in the last hour

File lib/ueberauth/strategy/twitter/oauth.ex line 20 in Ueberauth.Strategy.Twitter.OAuth.access_token/3 (ueberauth_twitter) args
File lib/ueberauth/strategy/twitter.ex line 29 in Ueberauth.Strategy.Twitter.handle_callback!/1 (ueberauth_twitter)
File lib/ueberauth/strategy.ex line 307 in Ueberauth.Strategy.run_callback/2 (ueberauth)
File lib/my_project_web/controllers/frontend/auth_controller.ex line 1 in MyProjectWeb.Frontend.AuthController.phoenix_controller_pipeline/2 (my_project)
File lib/phoenix/router.ex line 288 in Phoenix.Router.__call__/2 (phoenix)
File lib/plug/error_handler.ex line 64 in MyProjectWeb.Router.call/2 (my_project)
File lib/my_project_web/endpoint.ex line 1 in MyProjectWeb.Endpoint.plug_builder_call/2 (my_project)
File lib/my_project_web/endpoint.ex line 1 in MyProjectWeb.Endpoint.call/2 (my_project) 

The first argument to this function is a token, that is set in the session during the request phase, which was nil. Any idea how this could have happened?

@Awlexus
Copy link
Author

Awlexus commented Mar 25, 2020

We found the problem. The callback url was set to a different subdomain and the session was lost because of this.

Would it be possible to adjust the library to return an authentication error instead of crashing?

@Mazyod
Copy link

Mazyod commented Nov 29, 2020

In my case, I got this error in the logs, and it turns out during testing, I enter the auth URL in the browser, and Safari decides to show an autocompletion of the callback URL, while also making the http call. This leads to invalid token, and an exception show on the server logs.

It's a red herring probably, but would be great to handle such cases gracefully as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants