dexie / Dexie.js

A Minimalistic Wrapper for IndexedDB
https://dexie.org
Apache License 2.0
11.44k stars 641 forks source link

Possible to use 3rd party authentication (Supabase) with Dexie Cloud? #1628

Open jhanstra opened 1 year ago

jhanstra commented 1 year ago

I'm trying to hook up custom authentication with Dexie Cloud but the more I dive into it it seems that hooking up to a 3rd party authentication provider like Supabase would be impossible. Am I correct in thinking that I would need to fetch the token server-side, which would mean modifying the Supabase Auth source code to do this?

Is there any other way to use 3rd party auth like Supabase or Firebase? I would really prefer not to write my own custom authentication as I do not know how to do this. Thanks!

dfahlander commented 1 year ago

Hi!

Sorry for late answer. You don't need to alter the source code of Supabase or any other authentication provider. What you need is to have a custom backend that can authenticate your user using any other system, for example supabase (following their docs on how to integrate authentication), and then let that backend verify the user and then, when username is known, call dexie-cloud API to generate a token to your client, as examplified [here](https://dexie.org/cloud/docs/db.cloud.configure()#example-integrate-custom-authentication).