Replies: 1 comment
-
The fetchTokens is an async callback and can start any flow required for the authentication before returning its promise. However, an authentication flow can often involve redirections of entire page. Custom authentication will require you to control the backend that serves your frontend. So there are some options:
Both these scenarios are quite similar, just that the second one is prepared for non-authenticated users and take actions to initialize authentication flow. |
Beta Was this translation helpful? Give feedback.
-
I am currently looking at adding a custom auth integration and reviewing the example provided in the docs.
In this example, it appears that the assumption is I would call
db.cloud.login({ email: "foo@bar.com" )
which then would result in a call from dexie cloud to the endpoint I have added infetchTokens
incloud.config
.However, with that model, the server has to basically respond immediately with a token, which does not allow for completion of an actual login flow. (Eg an OTP roundtrip.)
It seems that the way this should work is that, once I have completed my custom login, I can do a POST to Dexie cloud "/login" endpoint that effectively is the equivalent of
db.cloud.login({ email: "foo@bar.com" )
but which is coming from a server. Without that I am not clear as to how the current custom auth model is practically useful.Any clarifications would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions