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

Use POST /sign_in to sign in. GET is not supported #348

Open
Neithenn opened this issue Jan 29, 2017 · 3 comments
Open

Use POST /sign_in to sign in. GET is not supported #348

Neithenn opened this issue Jan 29, 2017 · 3 comments

Comments

@Neithenn
Copy link

Hi guys,
I'm using ng-token-auth along with devise-toke-auth but I can't log in using any provider such as facebook, google...

Error: {"errors":["Use POST /sign_in to sign in. GET is not supported."]}

According to what it says, I should start a request using POST instead of GET but how can I make that happen?

My server logs indicates that I'm using GET: (is this correct? should be get or post?)

Started GET "/omniauth/facebook/callback?code=AQDDaj9TeGQDD8mrBBHYoCpPAIK0G2_iUWdt5OyvKuHiNGcd1jWQIUoWF-g5lJk0zO27XYx2dAlz84AS_uDsxV7v_bENTZJbT3rXL-9uDqcc-gIAy3Wp368EW1ZZ-7nUq-FI3bHd3tkyoJXrQ69YDaZA2X0BT4gbhZQ7uXWA8BUCz_vhVFjcYZE7YoPshEjW3s4Kf1na5LtPDpJk6m-8CiG0OoVIlZm6Qu-Mi2KP3mXD5wp88AwpcPMS5hYqVjIcVXGmpUaesq2Gv5eih5QyIpzySaChqj2HZt1JIFShiGfSbHXcTRad958GMoeGLeLCn1QhLu0jDscK-cQGOrvk6XQA&state=837234fae0523119f62b6a839ef3be2fab61c17b1947e953" for ::1 at 2017-01-29 14:07:15 -0300
Processing by Devise::OmniauthCallbacksController#failure as HTML
  Parameters: {"code"=>"AQDDaj9TeGQDD8mrBBHYoCpPAIK0G2_iUWdt5OyvKuHiNGcd1jWQIUoWF-g5lJk0zO27XYx2dAlz84AS_uDsxV7v_bENTZJbT3rXL-9uDqcc-gIAy3Wp368EW1ZZ-7nUq-FI3bHd3tkyoJXrQ69YDaZA2X0BT4gbhZQ7uXWA8BUCz_vhVFjcYZE7YoPshEjW3s4Kf1na5LtPDpJk6m-8CiG0OoVIlZm6Qu-Mi2KP3mXD5wp88AwpcPMS5hYqVjIcVXGmpUaesq2Gv5eih5QyIpzySaChqj2HZt1JIFShiGfSbHXcTRad958GMoeGLeLCn1QhLu0jDscK-cQGOrvk6XQA", "state"=>"837234fae0523119f62b6a839ef3be2fab61c17b1947e953"}
Redirected to http://localhost:3000/api/v1/auth/sign_in
Completed 302 Found in 37ms (ActiveRecord: 0.0ms)


Started GET "/api/v1/auth/sign_in" for ::1 at 2017-01-29 14:07:17 -0300
Processing by DeviseTokenAuth::SessionsController#new as HTML
Completed 405 Method Not Allowed in 1ms (Views: 0.0ms | ActiveRecord: 0.0ms)

As the documentation indicates my client side is made by:

$scope.facebooksignup = function(){
		debugger;
		 $auth.authenticate('facebook')
        .then(function(resp) {
          // handle success
        })
        .catch(function(resp) {
          // handle errors
        });

My app.js module config:

app.config(function($authProvider) {
       $authProvider.configure({
           apiUrl: 'http://localhost:3000/api/v1',
           validateOnPageLoad: false,
           authProviderPaths: {
              facebook: '/auth/facebook',
              google:   '/auth/google'
          }
       });
   });

And my ruby routes just in case:

  devise_token_auth/registrations#destroy
    api_v1_auth_validate_token GET      /api/v1/auth/validate_token(.:format)     devise_token_auth/token_validations#validate_token
           api_v1_auth_failure GET      /api/v1/auth/failure(.:format)            omniauth_callbacks#omniauth_failure
                               GET      /api/v1/auth/:provider/callback(.:format) omniauth_callbacks#omniauth_success
                               GET|POST /omniauth/:provider/callback(.:format)    omniauth_callbacks#redirect_callbacks
              omniauth_failure GET|POST /omniauth/failure(.:format)               omniauth_callbacks#omniauth_failure
                               GET      /api/v1/auth/:provider(.:format) 
@fnumono
Copy link

fnumono commented Feb 6, 2017

did you get the solution already?

@Neithenn
Copy link
Author

Neithenn commented Feb 6, 2017

Nope. I ended up using Firebase to handle social network authentication. :(

@hamzaaltaf
Copy link

anyone found solution to this problem?

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

3 participants