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

Add endpoints for user authentication #218

Merged
merged 9 commits into from
Sep 2, 2023

Conversation

mihow
Copy link
Collaborator

@mihow mihow commented Aug 30, 2023

Create user:
POST email & password to /api/v2/auth/users/

Login:
POST email & password to /api/v2/auth/token/login

Get user information from a restricted endpoint
GET /api/v2/auth/users/me/ -H 'Authorization: Token TOKEN'

Logout:
POST /api/v2/auth/token/logout/ --data 'TOKEN' -H 'Authorization: Token TOKEN'

https://djoser.readthedocs.io/en/latest/sample_usage.html

Endpoint docs:
https://djoser.readthedocs.io/en/latest/base_endpoints.html

You can
image

Email sending is configured, you will get a new account notice, and password reset emails should work. But the account activation link is currently disabled.

All write endpoints require authentication now:
image

Object-level permissions are not yet implemented, however to prepare the frontend, a list of placeholder permissions is given with every serialized object, e.g.:

{
                    "id": 33958,
                    "details": "http://localhost:8000/api/v2/captures/33958/",
                    "url": "https://.../022_06_21_snapshots/20220621050059-293-snapshot.jpg",
                    "width": 4096,
                    "height": 2160,
                    "timestamp": "2022-06-21T05:00:59",
                    "detections_count": null,
                    "detections": [],
                    "user_permissions": [
                        "update",
                        "delete",
                        "create"
                    ]
                },

@mihow mihow linked an issue Aug 30, 2023 that may be closed by this pull request
@netlify
Copy link

netlify bot commented Aug 30, 2023

Deploy Preview for ami-storybook canceled.

Name Link
🔨 Latest commit 53b58fa
🔍 Latest deploy log https://app.netlify.com/sites/ami-storybook/deploys/64f291c9f563cd000850eb54

@netlify
Copy link

netlify bot commented Aug 30, 2023

Deploy Preview for ami-web canceled.

Name Link
🔨 Latest commit 53b58fa
🔍 Latest deploy log https://app.netlify.com/sites/ami-web/deploys/64f291c97c767d0008ed1b8a

@mihow mihow changed the title 215 add endpoints for user authentication Add endpoints for user authentication Aug 30, 2023
@annavik
Copy link
Member

annavik commented Aug 30, 2023

Thanks for the fast fix, this looks very promising!! I can definitely start on the FE side of things with this

@mihow mihow marked this pull request as ready for review August 30, 2023 07:14
@mihow mihow merged commit 107fcf0 into main Sep 2, 2023
6 checks passed
@mihow mihow deleted the 215-add-endpoints-for-user-authentication branch November 17, 2023 21:35
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

Successfully merging this pull request may close these issues.

Add endpoints for user authentication
2 participants