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
Cannot get ng-token-auth, devise-token-auth and Rails to work for facebook login #551
Comments
+1 |
I have the exact same problem. Were you able to solve it? |
I solved this by making the following change |
I managed by overriding omniauth_callbacks_controller and token_validations_controller. |
Sounds like we have a proposed solution here, closing for now. |
I apologize if this question has been answered before. If it is, please point to the solution. But for the life of it I can not figure out how to get an AngularJS client (using ng-token-auth) and Rails 4.2 server (using devise-token-auth) to work with Facebook for login/signup, etc. I have googled this topic and read through a lot of suggestions and ideas but NOT a concrete solution. So I finally decided to ask the experts. Here it goes:
THE SYMPTOM:
When I initiate a $auth.authenticate('facebook') call on client, I get the HTTP request from facebook to
the redirect_url on rails server, at http://localhost:3008/api/v1/auth/facebook/callback which map to
'devise_token_auth/omniauth_callbacks#redirect_callbacks' in routes.rb
I also have another route defined in when I do 'rake routes'
I am not sure why I have two routes defined, but only the first one (redirect_callbacks) gets called.
snippet from config/routes.rb
Snippet from config/devise_token_auth.rb
The Application Controller:
My request from facbook to server raises an exception "No resource_class found" at line 184 in devise_token_auth/omniauth_controller_callback.rb:
Note: If I am logged into Facebook from browser, I get the Facebook login page in a new tab. After logging into to Facebook, I get the same exception as above.
In a debug session the omniauth_params has only following two things:
As you can see there is no "access_token", "resource_class" or any other fields available in omniauth.params which is causing this exception. I have checked both client and server configuration multiple times and compared it with documentation for both ng-token-auth and devise-token-auth and it seems to be correct. I somehow can't get this to work. So I am asking for your help.
Following is my client and server configuration if that helps.
Client Configuration:
Server Configuration
NOTE: I need devise and devise_token_auth to co-exist to support legacy application.
The text was updated successfully, but these errors were encountered: