marmelab / ra-supabase

Supabase adapter for react-admin, the frontend framework for building admin applications on top of REST/GraphQL services.
MIT License
156 stars 27 forks source link

Feat: Handle HashRouter & BrowserRouter for Supabase redirections #67

Closed arimet closed 3 months ago

arimet commented 3 months ago

Problem

As a developer, I want to be able to choose between the HashRouter and the BrowserRouter.

Solution

Modify the DataProvider's handleCallback function and useSupabaseAccessToken to retrieve query params when using a URL Hash or history url.

Other

Improve documentation

How to test

BrowserRouter

  1. Launch demo
  2. Through the Authentication dashboard sent a reset email to an user. You can see the email sent in Inbucket. Instead of clicking the link, copy it and change the redirect_to parameter from http://localhost:8000 to http://localhost:8000/auth-callback.

HashRouter

  1. Remove from demo App.ts
  2. Check that public/auth-callback/index.html is created
  3. Same step as BrowserRouter 3, but set redirect_to with http://localhost:8000/auth-callback/index.html