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

signOut not working #28

Open
Ruff9 opened this issue Dec 29, 2016 · 2 comments
Open

signOut not working #28

Ruff9 opened this issue Dec 29, 2016 · 2 comments

Comments

@Ruff9
Copy link

Ruff9 commented Dec 29, 2016

I'm using jToker alongside devise_token_auth, nothing but standard.

I can't logout using $.auth.signOut(). I got a 404 in the console, and when I curl the request I get

"errors":["User was not found or was not logged in."]

I found this SO post

http://stackoverflow.com/questions/32507637/why-am-i-unable-to-sign-out-using-devise-token-auth-and-curl

but I can't succeed with this method, and I think that jToker documentation is missing something or outdated.

@Ruff9
Copy link
Author

Ruff9 commented Dec 29, 2016

I found the solution in @kunovski answer to this issue : #7

it was a problem of CORS configuration (server-side pb). I quote his answer:

You should do this:

Rails.application.config.middleware.insert_before 0, Rack::Cors do
  allow do
    origins 'example.com'

    resource '*',
      headers: :any,
      methods: [:get, :post, :put, :patch, :delete, :options, :head]
  end
end

Instead of:

Rails.application.config.middleware.insert_before 0, Rack::Cors do
  allow do
    origins 'example.com'
    resource '*',
      headers: :any,
      expose: ['access-token', 'token-type', 'client', 'expiry', 'uid'],
      methods: [:get, :post, :put, :patch, :delete, :options, :head]
  end
end

@up_the_irons
Copy link

You still need expose: ['access-token', 'token-type', 'client', 'expiry', 'uid'] in there

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