forked from redwoodjs/redwood
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [Auth] Common AuthProvider & use* changes for middleware auth (r…
…edwoodjs#10420) Pairing with @dthyresson - First step of supporting Auth using middleware. This PR is the smallest slice possible. - Also removes the unused `skipFetchCurrentUser`, that was only used in `nhost` - a deprecated auth provider. This technically makes this change breaking, so we need to think it through! To make use of this functionality, we will need: **1. A specialised middleware auth client** (naming TBC) - in your `web/src/auth.ts`, you will need to instantiate the create auth differently. ``` import { createDbAuthClient, createMiddlewareAuth, // 👈 not in this PR } from '@redwoodjs/auth-dbauth-web' const dbAuthClient = createDbAuthClient({ middleware: true, // 👈 not in this PR }) export const { AuthProvider, useAuth } = createMiddlewareAuth(dbAuthClient) ``` 2. The middleware to perform auth ``` export const registerMiddleware = () => { console.log('Registering middleware') const dbAuthMiddleware = createDbAuthMiddleware({ cookieName, }) return [dbAuthMiddleware] } ``` 4. Updated dbAuth handler for dbAuth **Checklist** - [x] Ensure backwards compatibility with non-SSR auth - [x] Should we undo the changes to `skipFetchCurrentUser` --------- Co-authored-by: David Thyresson <[email protected]>
- Loading branch information
1 parent
07361ec
commit 3252de7
Showing
6 changed files
with
33 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
- feat: [Auth] Common AuthProvider & use* changes for middleware auth #10420 by @dac09 and @dthyresson | ||
|
||
* First step of supporting Auth using middleware | ||
* Ensure backwards compatibility with non-SSR auth | ||
|
||
### Breaking Change | ||
|
||
Removes `skipFetchCurrentUser` which was used by the no longer existing nHost auth provider, but could potentially have been used by custom auth. | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters