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

Default implementation should include login example #3

Open
zelenij opened this issue Apr 12, 2021 · 2 comments
Open

Default implementation should include login example #3

zelenij opened this issue Apr 12, 2021 · 2 comments

Comments

@zelenij
Copy link

zelenij commented Apr 12, 2021

Almost any app would want to use authentication. While the server side implementation in the template can be just a plug:

let login username password =
    if username = "jonh" && password = "123" then
        Ok username
     else
        Error "go away"

the whole plumbing of Fable/Feliz communicating with the server and updating global state (for logged in status, for example) is not very trivial for a beginner and would deserve a simple example. I could only make it work with Elmish, not with the provided sample of useDeferredCallback

@Dzoukr
Copy link
Owner

Dzoukr commented Apr 12, 2021

I partially agree. It's not a trivial task, but on the other hand, it would make the whole template more robust with things like JWT access token generation, refresh token retrieval, refreshes on the background, etc... It would also imply a single solution for authentication where there are many of those (custom, Azure AD, Auth0, etc...)

@zelenij
Copy link
Author

zelenij commented Apr 12, 2021

Let me reiterate - I explicitly don't want to provide any meaningful server side implementation for this very reason. Just have a simple function which checks a hard coded user - and send a cookie if passes. The real value for the template users would be in showing how client <-> server communication actually happens. With React state update.

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