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

How to Restrict Access to a Single Client? #854

Closed
stratigos opened this issue Mar 21, 2017 · 3 comments
Closed

How to Restrict Access to a Single Client? #854

stratigos opened this issue Mar 21, 2017 · 3 comments

Comments

@stratigos
Copy link
Contributor

I can't seem to find this in the documentation, and diddn't notice anything in the configuration regarding this: how can I restrict access to a single client? I am wondering if there is a way I can actually eliminate multi device support for my API, and if it is possible to limit an end user to the device that she/he registered with, allowing no other devices. If this can be achieved through the devise_token_auth (or devise) configuration, that would be helpful to know about. TIA :)

@andoq
Copy link

andoq commented Apr 20, 2017

There is a max_number_of_devices config setting for devise token auth. I haven't tried to set it to 1, but you could try. This is present and commented out in the config file that is generated by rails g devise_token_auth:install

@stratigos
Copy link
Contributor Author

Thanks @andoq, Ill try that out if I need to implement this feature. I dont think this fully accomplishes what I want, which is to prevent an additional device to connect to an API.

The max_number_of_devices setting looks like it just invalidates the session on "older" devices once the max has been reached.

I suspect Ill need to roll my own, in terms of identifying a specific user device and disallowing any others. I was just hoping I missed something already baked in to either this or the devise source.

@zachfeldman
Copy link
Contributor

Probably @stratigos . Let us know how that went! Closing this for now though.

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