-
Notifications
You must be signed in to change notification settings - Fork 595
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
As a headless developer I can access the current user's name, username, etc. easily #4810
Comments
hi can i work on this issue is it still open to work on ? |
hi @boutell , can you please assign this task to me? |
Hi @KDrop25 and @adarsh1114, |
Is anyone actively working on this? If not, I'd like to get a try |
@eladavn As far as I know, there isn't anybody working on this. You are welcome to give it a go! |
Would I be right to assume that the |
Correct. It would be an endpoint that is implemented by the core apostrophe login module. |
Originally:
apostrophecms-legacy/apostrophe-headless#61
(Back in the A2 era, but still a good idea)
Right now a pure headless Apostrophe developer can't display the current user's name, which is silly and lacks parity with what Nunjucks developers can easily do.
Of course they can implement their own apiRoute for it at project level but it is good for headless developers to have access to things with roughly the same level of effort as those using ordinary full page Apostrophe rendering.
The goal is to implement the following API via the
apiRoutes
feature in Apostrophe's core login module:Which would return the following information about the user who made the request (
req.user
):The @apostrophecms/login module would be given new options, minimumWhoamiFields and whoamiFields. minimumWhoamiFields would default to [ '_id', 'username', 'title', 'email' ] and whoamiFields would default to []. The final list would be the concatenation of the two.
This is for convenience: developers can add fields without restating the list or accidentally breaking code that reasonably relies on this API's defaults unless they really want to go there.
If
req.user
does not exist a 404 should be generated (throw self.apos.error('notfound')
)Since we don't have a customer requirement for this at this time, I've tagged it for a potential open source community contribution. Due to the clear technical description above, I have also tagged it as a good first issue for anyone willing to spend time with the Apostrophe documentation re:
apiRoutes
.[Internal note: see PRO-6828]
The text was updated successfully, but these errors were encountered: