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

Decouple auth #5985

Merged
merged 227 commits into from Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from 204 commits
Commits
Show all changes
227 commits
Select commit Hold shift + click to select a range
e7cd5b1
AuthProvider: Don't type cast createAuthClient args
Tobbe Jul 17, 2022
32e2245
AuthProvider: Get rid of unused AuthContext init params
Tobbe Jul 17, 2022
f78541f
Provide types for web auth methods
Tobbe Jul 18, 2022
c7fb3e4
Minor updates after writing PR description
Tobbe Jul 18, 2022
5b552a2
AuthProvider: 'type' from authImpl
Tobbe Jul 20, 2022
c175b8e
Auth: Custom getCurrentUser
Tobbe Jul 22, 2022
5c230a4
Update more auth providers implementations
Tobbe Jul 22, 2022
2e5bc65
Export auth fatory methods
Tobbe Jul 22, 2022
e9687e7
Create wrapper methods to help TS with types
Tobbe Jul 22, 2022
ee9018c
SuperTokens authImplementation
Tobbe Jul 23, 2022
b2399ee
Okta authImplementation
Tobbe Jul 23, 2022
1e85b85
GoTrue authImplementation
Tobbe Jul 23, 2022
f640d85
MagicLink authImplementation
Tobbe Jul 23, 2022
0659477
Firebase authImplementation
Tobbe Jul 23, 2022
04ffe3e
Auth0 authImplementation
Tobbe Jul 23, 2022
50401f3
Ethereum and AzureActiveDirectory authImplementation
Tobbe Jul 23, 2022
1ae28a2
Get rid of authClients
Tobbe Jul 23, 2022
6f659f5
Export auth factories
Tobbe Jul 23, 2022
6d74fe7
useAuth all over the place
Tobbe Jul 23, 2022
73a2516
Merge branch 'main' into tobbe-decouple-auth-web
Tobbe Jul 23, 2022
74f12a1
Update yarn.lock
Tobbe Jul 23, 2022
d25dc1e
useNoAuth
Tobbe Jul 23, 2022
1c2eeeb
Relative imports
Tobbe Jul 23, 2022
62cacc0
update test-project fixture
Tobbe Jul 23, 2022
f408e9f
Merge branch 'main' into tobbe-decouple-auth-web
Tobbe Jul 27, 2022
014362d
Make all Auth tests pass
Tobbe Jul 27, 2022
5a24d17
Fix router tests
Tobbe Aug 2, 2022
17b3d8b
Better solution for tests
Tobbe Aug 2, 2022
32b5bdb
Merge branch 'main' into tobbe-decouple-auth-web
Tobbe Aug 2, 2022
f75df36
Merge branch 'main' into tobbe-decouple-auth-web
Tobbe Aug 2, 2022
c592e3c
No global useAuth
Tobbe Aug 2, 2022
9acc39f
Simplify types
Tobbe Aug 3, 2022
656b23e
setup types for netlify-identity
Tobbe Aug 4, 2022
8325387
useListenForUpdates and clerk updates
Tobbe Aug 4, 2022
4521555
Merge branch 'main' into tobbe-decouple-auth-web
Tobbe Aug 5, 2022
b470ce7
Update clerk integration
Tobbe Aug 6, 2022
cc2dc57
auth setup: print correct ts/js file ext
Tobbe Aug 6, 2022
3bd6cd2
Pass through client to useAuth. Enable WebAuthn for dbAuth
Tobbe Aug 6, 2022
a23a1c2
Fix ethereum authImplementation
Tobbe Aug 6, 2022
1dec9b9
web side auth.ts templates
Tobbe Aug 6, 2022
072886a
auth setup
Tobbe Aug 6, 2022
bce3f1a
More auth setup tests
Tobbe Aug 6, 2022
1bf9a5e
Code review fixes
Tobbe Aug 6, 2022
f5822e9
Update useNoAuth so router unit tests pass
Tobbe Aug 7, 2022
d91fa9e
auth setup: Warn if we can't find RedwoodApolloProvider
Tobbe Aug 7, 2022
34f72bb
Auth handler tests
Tobbe Aug 7, 2022
d1400c9
Update README.md
Tobbe Aug 7, 2022
68ef83f
lib templates: Use currentUserRoles everywhere for better TS experience
Tobbe Aug 7, 2022
a08f8a8
Clean up provider specific config that has moved to separate files
Tobbe Aug 7, 2022
af2659e
Custom auth setup command
Tobbe Aug 7, 2022
a3b346c
Fix import order in auth templates
Tobbe Aug 8, 2022
b63abdb
netlify auth: fix package lis
Tobbe Aug 8, 2022
881f7a0
Merge branch 'main' into tobbe-decouple-auth-web
Tobbe Aug 9, 2022
d0f0ffb
auth-providers and mocked useAuth
Tobbe Aug 12, 2022
5c44cfa
auth setup: Update RedwoodApolloProvider warning message
Tobbe Aug 12, 2022
2004ee2
auth setup: Use @redwoodjs/auth-providers
Tobbe Aug 12, 2022
c749b91
dbAuth test login
Tobbe Aug 12, 2022
1bfba4e
dbAuth test logout
Tobbe Aug 12, 2022
3026bce
Test customProviderHooks in AuthProvider
Tobbe Aug 12, 2022
e5c665d
Update test snapshots
Tobbe Aug 12, 2022
6883b17
Merge branch 'main' of https://github.com/redwoodjs/redwood into tobb…
Tobbe Aug 12, 2022
0d7c646
Updated test-project fixture
Tobbe Aug 12, 2022
9513ac6
Fix bad merge
Tobbe Aug 12, 2022
3606d8f
Update dbAuth page templates
Tobbe Aug 12, 2022
1f6e272
Update test-project codemods
Tobbe Aug 12, 2022
251669d
internal fixture: Update useAuth import
Tobbe Aug 12, 2022
2c27eda
Clean up MockProviders
Tobbe Aug 12, 2022
b72c3e3
update test-project fixture
Tobbe Aug 12, 2022
f158a07
Use path.sep cuz Windows
Tobbe Aug 12, 2022
15d1935
Handle windows paths
Tobbe Aug 12, 2022
b5faf04
One more test to fix
Tobbe Aug 12, 2022
a2ed373
Mock useAuth for StoryBook
Tobbe Aug 16, 2022
2e2fa75
Tweak SB config
Tobbe Aug 16, 2022
e1dfa48
Smarter hasRole mock
Tobbe Aug 17, 2022
85fabf2
rbacChecks: Make it less flakey
Tobbe Aug 17, 2022
d6f910c
Merge branch 'main' of https://github.com/redwoodjs/redwood into tobb…
Tobbe Aug 21, 2022
0a06a0f
auth0 tests
Tobbe Aug 21, 2022
9ae931e
AzureActiveDirectory tests
Tobbe Aug 21, 2022
c94a786
Clerk tests
Tobbe Aug 21, 2022
53f3157
Updated yarn.lock
Tobbe Aug 21, 2022
2366f15
Test GoTrue and Netlify
Tobbe Aug 21, 2022
537d102
yarn constraints fix
Tobbe Aug 21, 2022
dbd1083
Move auth api templates into api folder
Tobbe Aug 21, 2022
2ae28c1
authFiles: More accurate comment
Tobbe Aug 21, 2022
7057569
Auth setup: Group tempalates by provider
Tobbe Aug 21, 2022
88eac96
Support arbritary files/templates
Tobbe Aug 21, 2022
44dc439
Supertokens auth setup
Tobbe Aug 21, 2022
a6f74a7
setup auth: fix api output path
Tobbe Aug 22, 2022
4c4a761
Handle existing files + ts and js projects
Tobbe Aug 22, 2022
72067b3
fix yarn constraints
jtoar Aug 22, 2022
c3b5467
Better support for multiple auth providers on the api side
Tobbe Aug 22, 2022
8b4bc7b
Merge branch 'tobbe-decouple-auth-web' of https://github.com/Tobbe/re…
Tobbe Aug 22, 2022
0698891
Merge branch 'main' of https://github.com/redwoodjs/redwood into tobb…
Tobbe Aug 24, 2022
e9ae1cd
Merge branch 'main' of https://github.com/redwoodjs/redwood into tobb…
Tobbe Aug 24, 2022
5cfe770
Start moving setup commands into provider specific folders
Tobbe Aug 25, 2022
b2b14db
Update supertokens templates
Tobbe Sep 1, 2022
fbe2bc2
Auth specific setup scripts
Tobbe Sep 1, 2022
57aa7f9
authFiles, authTasks: Switch to TS
Tobbe Sep 2, 2022
0d23309
Start moving setup scripts to the auth-providers package
Tobbe Sep 2, 2022
9088c39
Tighten up Telemetry types
Tobbe Sep 6, 2022
cf62a1e
rw/cli tsconfig
Tobbe Sep 7, 2022
e86d46a
@redwoodjs/cli-helpers
Tobbe Sep 8, 2022
1caef09
Keep moving setup scripts to the auth-provider package
Tobbe Sep 8, 2022
f21a728
Moved all auth provider setup scripts to the auth-provider package
Tobbe Sep 8, 2022
ddec968
Update auth-helper exports. Move helper function to cli-helpers
Tobbe Sep 9, 2022
6ff10af
Re-add setup auth command
Tobbe Sep 9, 2022
8704d6b
Use cli-helpers methods in the cli package
Tobbe Sep 9, 2022
d387d37
Setup commands happy-path working
Tobbe Sep 9, 2022
abf9043
Use unique filenames to avoid overwriting existing files
Tobbe Sep 10, 2022
b73149a
Restructure netlify auth
Tobbe Sep 10, 2022
7c5759a
Restructure auth-provider package
Tobbe Sep 11, 2022
4aabcca
Revert "Use cli-helpers methods in the cli package"
Tobbe Sep 12, 2022
99e9766
CLI keeps its methods
Tobbe Sep 12, 2022
5524f32
cli: clean up package config
Tobbe Sep 12, 2022
8efb92e
graphql-server: fix tests and improve typing
Tobbe Sep 12, 2022
b55368f
authFiles: Rename files -> apiSideFiles
Tobbe Sep 12, 2022
253657f
cli-helpers: Add test for auth setup helpers
Tobbe Sep 12, 2022
d398dcc
Start adding authDecoder to some auth setup commands
Tobbe Sep 12, 2022
bdf08f3
cli project.js: Add back missing method
Tobbe Sep 12, 2022
21fb921
Fix broken merge in cli scripts
Tobbe Sep 12, 2022
4a8160f
Merge branch 'main' of https://github.com/redwoodjs/redwood into tobb…
Tobbe Sep 13, 2022
fecf7ee
Make it build
Tobbe Sep 13, 2022
c40abfb
Update test project fixture
Tobbe Sep 13, 2022
c201b1a
auth-providers-setup package
Tobbe Sep 13, 2022
0349a72
auth-providers-setup: Remove web and api folders
Tobbe Sep 13, 2022
f814673
auth-providers-setup: restructure package
Tobbe Sep 13, 2022
5a1b789
Try adding types to telemetry
Tobbe Sep 13, 2022
ef74a6f
auth-providers-web
Tobbe Sep 13, 2022
a209c68
auth-providers-web: Remove non-web files
Tobbe Sep 13, 2022
ed80af6
auth-providers-web: restructure
Tobbe Sep 13, 2022
f3ff49f
auth setup: Fix template imports
Tobbe Sep 13, 2022
7248cb7
auth-providers: Only export api stuff
Tobbe Sep 13, 2022
27bae69
auth-providers-web: correct package name
Tobbe Sep 13, 2022
7e95bd3
auth-providers -> auth-providers-api
Tobbe Sep 13, 2022
7e08f92
Update yarn.lock
Tobbe Sep 13, 2022
88c724d
Update auth-providers import
Tobbe Sep 13, 2022
b10f032
Make all tests pass
Tobbe Sep 13, 2022
6fe0869
Update test project fixture
Tobbe Sep 13, 2022
960907e
Fix package imports
Tobbe Sep 13, 2022
e531d1a
Fix imports and update test-project fixture
Tobbe Sep 13, 2022
b56a46b
Pass auth-provider type to auth decoders
Tobbe Sep 14, 2022
f9fd13b
auth decoders: Use Decoder type
Tobbe Sep 14, 2022
4c34b24
Netlify setup: Temporarily disable rw auth package installation
Tobbe Sep 14, 2022
0b39be7
strict mode
Tobbe Sep 21, 2022
3f5b089
Merge branch 'main' of https://github.com/redwoodjs/redwood into tobb…
Tobbe Sep 21, 2022
409dd1e
Fix broken merge
Tobbe Sep 21, 2022
79c07b9
Fix package deps
Tobbe Sep 21, 2022
76b9cba
Tweak regexps to fix code scanning issues
Tobbe Sep 21, 2022
4cedbe1
Atomic group regex
Tobbe Sep 21, 2022
65cbdba
One more atomic group regex
Tobbe Sep 21, 2022
7d463a2
yarn constraints fix
Tobbe Sep 21, 2022
5be40bb
Revert "yarn constraints fix"
Tobbe Sep 21, 2022
0b9c826
manual yarn constraints fix
Tobbe Sep 21, 2022
d1880fb
More manual version updates
Tobbe Sep 21, 2022
6f13352
Don't use carret versions
Tobbe Sep 21, 2022
6941755
update lockfile
Tobbe Sep 21, 2022
81c3d47
Fix lint warnings
Tobbe Sep 22, 2022
aa30190
Merge branch 'main' into tobbe-decouple-auth-web
Tobbe Sep 22, 2022
7b4af55
Remove DMMF import
Tobbe Sep 22, 2022
c2a29c3
Update snapshots
Tobbe Sep 22, 2022
e12c3a7
Merge branch 'main' of https://github.com/redwoodjs/redwood into tobb…
Tobbe Sep 23, 2022
a15c8fa
Use node14 compatible syntax
Tobbe Sep 24, 2022
9ef67aa
Fix api side auth imports
Tobbe Sep 24, 2022
dbe9788
Merge branch 'main' of https://github.com/redwoodjs/redwood into tobb…
Tobbe Sep 24, 2022
e45f539
Fix yarn.lock
Tobbe Sep 24, 2022
0c77b56
Update regex
Tobbe Sep 24, 2022
b15b506
Tweak regex
Tobbe Sep 24, 2022
c9506cc
Avoid red squiggles in generated code
Tobbe Sep 24, 2022
a7c9eb1
Updated test fixture
Tobbe Sep 25, 2022
4f2a08a
Export Decoded
Tobbe Sep 25, 2022
b2891df
dbAuth template types
Tobbe Sep 25, 2022
447894c
Update test-project fixture
Tobbe Sep 25, 2022
dc67981
Merge branch 'main' into tobbe-decouple-auth-web
Tobbe Sep 25, 2022
04b78c6
Add jsonwebtoken to auth-providers-api deps
Tobbe Sep 26, 2022
54b0e03
auth-providers-api: Update jest config
Tobbe Sep 26, 2022
d3e3237
Merge branch 'main' of https://github.com/redwoodjs/redwood into tobb…
Tobbe Sep 26, 2022
d9c0829
auth-providers-api: Add azureAD tests
Tobbe Sep 27, 2022
323a42b
Update azureAD test and decoder
Tobbe Sep 28, 2022
c00cd9f
auth-providers-api: test clerk
Tobbe Sep 28, 2022
79696ed
auth-providers-api ethereum tests
Tobbe Sep 28, 2022
52de546
auth-providers-api: firebase tests
Tobbe Sep 28, 2022
92bc121
use default req in tests
Tobbe Sep 28, 2022
df86819
auth-providers-api: goTrue tests
Tobbe Sep 28, 2022
44b1186
auth-providers-api: netlify tests
Tobbe Sep 28, 2022
d9bc41c
Test magicLink
Tobbe Sep 28, 2022
41be8f7
Test nhost decoder
Tobbe Sep 28, 2022
28cf2c7
test okta decoder
Tobbe Sep 28, 2022
0c760a3
okta tests: Better types
Tobbe Sep 28, 2022
f76dda8
test supabase decode
Tobbe Sep 28, 2022
9605016
supertokens decoder tests
Tobbe Sep 28, 2022
dca7b92
Duplicate mock req to make tests standalone
Tobbe Sep 28, 2022
eaf9c53
auth-providers-web: ethereum and firebase tests
Tobbe Sep 28, 2022
7c7aa6f
fix: resolve firebase/auth and deps to commonjs
jtoar Sep 28, 2022
4dcfd50
Fix firebase tests
Tobbe Sep 29, 2022
1d0fd3b
Type-tweak to firebase test
Tobbe Sep 29, 2022
2cc0f7c
test magicLink
Tobbe Sep 29, 2022
6fde0b5
auth-providers-web: test nhost
Tobbe Sep 29, 2022
4b9245c
okta tests
Tobbe Sep 29, 2022
ef7f1e9
Test supabase and supertokens
Tobbe Sep 29, 2022
618a339
Add usage warning and prompt to auth setup
Tobbe Sep 30, 2022
01edcf5
Merge branch 'main' of https://github.com/redwoodjs/redwood into tobb…
Tobbe Sep 30, 2022
a73ae14
Fix merge resolutions
Tobbe Sep 30, 2022
0cfc5ef
Fix package versions
Tobbe Sep 30, 2022
309b0c7
Allow bypassing auth setup prompt (for CI)
Tobbe Sep 30, 2022
e975df0
auth docs: custom auth
Tobbe Sep 30, 2022
2a9c90b
Temporary fix for dbauth webauthn
Tobbe Oct 1, 2022
3530674
Update packages/cli/src/commands/__tests__/test.test.js
Tobbe Oct 9, 2022
ce25109
Review comment fixes. Biggest one is switching to listr2 in cli-helpers
Tobbe Oct 9, 2022
cbb7685
Merge branch 'tobbe-decouple-auth-web' of https://github.com/Tobbe/re…
Tobbe Oct 9, 2022
0c4c38f
Revert unneeded change
Tobbe Oct 9, 2022
f12b6d9
Add changes from #6372
Tobbe Oct 9, 2022
caa4b02
Fix clerk auth build error
Tobbe Oct 9, 2022
1184028
Fix #6372 implementation
Tobbe Oct 9, 2022
16767b8
Add missign auth decoder exports
Tobbe Oct 9, 2022
39fff4e
Update auth imports
Tobbe Oct 9, 2022
422b976
Add firebase anon auth
Tobbe Oct 10, 2022
2366047
cli-helpers: listr2 dep, and test fixes
Tobbe Oct 13, 2022
12947f4
auth2
Tobbe Oct 13, 2022
a0a2cdc
dbAuth passwordValidation
Tobbe Oct 13, 2022
86d246f
Minimize changes to packages/api
Tobbe Oct 13, 2022
4518c41
Minimize changes to packages/auth
Tobbe Oct 13, 2022
74695b7
Merge branch 'main' of https://github.com/redwoodjs/redwood into tobb…
Tobbe Oct 13, 2022
0a22e49
Fix bad merge
Tobbe Oct 13, 2022
8cef430
Move to @rwjs/auth instead of auth2
Tobbe Oct 13, 2022
31322f7
Fix cli-helpers test
Tobbe Oct 13, 2022
53445e9
auth2 -> auth fixes
Tobbe Oct 13, 2022
a532c9e
Merge branch 'main' of https://github.com/redwoodjs/redwood into tobb…
Tobbe Oct 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions __fixtures__/test-project/api/src/functions/auth.ts
@@ -1,7 +1,9 @@
import type { APIGatewayProxyEvent, Context } from 'aws-lambda'

import { DbAuthHandler } from '@redwoodjs/api'
import type { DbAuthHandlerOptions } from '@redwoodjs/api'
import {
DbAuthHandler,
DbAuthHandlerOptions,
} from '@redwoodjs/auth-providers-api/dist/dbAuth'

import { db } from 'src/lib/db'

Expand Down
2 changes: 2 additions & 0 deletions __fixtures__/test-project/api/src/functions/graphql.ts
@@ -1,3 +1,4 @@
import { dbAuthAuthDecoder as authDecoder } from '@redwoodjs/auth-providers-api'
jtoar marked this conversation as resolved.
Show resolved Hide resolved
import { createGraphQLHandler } from '@redwoodjs/graphql-server'

import directives from 'src/directives/**/*.{js,ts}'
Expand All @@ -9,6 +10,7 @@ import { db } from 'src/lib/db'
import { logger } from 'src/lib/logger'

export const handler = createGraphQLHandler({
authDecoder,
getCurrentUser,
loggerConfig: { logger, options: {} },
directives,
Expand Down
Expand Up @@ -10,7 +10,7 @@ export const standard = defineScenario<Prisma.PostCreateArgs>({
body: 'String',
author: {
create: {
email: 'String9043010',
email: 'String3085996',
hashedPassword: 'String',
fullName: 'String',
salt: 'String',
Expand All @@ -24,7 +24,7 @@ export const standard = defineScenario<Prisma.PostCreateArgs>({
body: 'String',
author: {
create: {
email: 'String3280784',
email: 'String9850549',
hashedPassword: 'String',
fullName: 'String',
salt: 'String',
Expand Down
Expand Up @@ -6,15 +6,15 @@ export const standard = defineScenario<Prisma.UserCreateArgs>({
user: {
one: {
data: {
email: 'String4277909',
email: 'String1877407',
hashedPassword: 'String',
fullName: 'String',
salt: 'String',
},
},
two: {
data: {
email: 'String493680',
email: 'String6139882',
hashedPassword: 'String',
fullName: 'String',
salt: 'String',
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/test-project/scripts/seed.ts
Expand Up @@ -95,7 +95,7 @@ export default async () => {
// and associated `salt` to their record. Here's how to create them using
// the same algorithm that dbAuth uses internally:
//
// import { hashPassword } from '@redwoodjs/api'
// import { hashPassword } from '@redwoodjs/auth-providers-api/dbAuth'
jtoar marked this conversation as resolved.
Show resolved Hide resolved
//
// const users = [
// { name: 'john', email: 'john@example.com', password: 'secret1' },
Expand Down
2 changes: 1 addition & 1 deletion __fixtures__/test-project/web/package.json
Expand Up @@ -24,7 +24,7 @@
},
"devDependencies": {
"autoprefixer": "^10.4.12",
"postcss": "^8.4.16",
"postcss": "^8.4.17",
"postcss-loader": "^7.0.1",
"prettier-plugin-tailwindcss": "^0.1.13",
"tailwindcss": "^3.1.8"
Expand Down
7 changes: 4 additions & 3 deletions __fixtures__/test-project/web/src/App.tsx
@@ -1,18 +1,19 @@
import { AuthProvider } from '@redwoodjs/auth'
import { FatalErrorBoundary, RedwoodProvider } from '@redwoodjs/web'
import { RedwoodApolloProvider } from '@redwoodjs/web/apollo'

import FatalErrorPage from 'src/pages/FatalErrorPage'
import Routes from 'src/Routes'

import { AuthProvider, useAuth } from './auth'

import './scaffold.css'
import './index.css'

const App = () => (
<FatalErrorBoundary page={FatalErrorPage}>
<RedwoodProvider titleTemplate="%PageTitle | %AppTitle">
<AuthProvider type="dbAuth">
<RedwoodApolloProvider>
<AuthProvider>
<RedwoodApolloProvider useAuth={useAuth}>
jtoar marked this conversation as resolved.
Show resolved Hide resolved
<Routes />
</RedwoodApolloProvider>
</AuthProvider>
Expand Down
4 changes: 3 additions & 1 deletion __fixtures__/test-project/web/src/Routes.tsx
Expand Up @@ -13,9 +13,11 @@ import BlogLayout from 'src/layouts/BlogLayout'
import ScaffoldLayout from 'src/layouts/ScaffoldLayout'
import HomePage from 'src/pages/HomePage'

import { useAuth } from './auth'

const Routes = () => {
return (
<Router>
<Router useAuth={useAuth}>
jtoar marked this conversation as resolved.
Show resolved Hide resolved
<Route path="/login" page={LoginPage} name="login" />
<Route path="/signup" page={SignupPage} name="signup" />
<Route path="/forgot-password" page={ForgotPasswordPage} name="forgotPassword" />
Expand Down
3 changes: 3 additions & 0 deletions __fixtures__/test-project/web/src/auth.ts
@@ -0,0 +1,3 @@
import { createDbAuth } from '@redwoodjs/auth-providers-web'
jtoar marked this conversation as resolved.
Show resolved Hide resolved

export const { AuthProvider, useAuth } = createDbAuth()
Expand Up @@ -2,9 +2,10 @@ type BlogLayoutProps = {
children?: React.ReactNode
}

import { useAuth } from '@redwoodjs/auth'
import { Link, routes } from '@redwoodjs/router'

import { useAuth } from 'src/auth'

const BlogLayout = ({ children }: BlogLayoutProps) => {
const { logOut, isAuthenticated } = useAuth()

Expand Down
@@ -1,11 +1,12 @@
import { useEffect, useRef } from 'react'

import { useAuth } from '@redwoodjs/auth'
import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms'
import { navigate, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'
import { toast, Toaster } from '@redwoodjs/web/toast'

import { useAuth } from 'src/auth'

const ForgotPasswordPage = () => {
const { isAuthenticated, forgotPassword } = useAuth()

Expand Down
@@ -1,7 +1,6 @@
import { useRef } from 'react'
import { useEffect } from 'react'

import { useAuth } from '@redwoodjs/auth'
import {
Form,
Label,
Expand All @@ -14,6 +13,8 @@ import { Link, navigate, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'
import { toast, Toaster } from '@redwoodjs/web/toast'

import { useAuth } from 'src/auth'

const LoginPage = () => {
const { isAuthenticated, logIn } = useAuth()

Expand Down
@@ -1,7 +1,8 @@
import { useAuth } from '@redwoodjs/auth'
import { Link, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'

import { useAuth } from 'src/auth'

const ProfilePage = () => {
const { currentUser, isAuthenticated, hasRole, loading } = useAuth()

Expand Down
@@ -1,6 +1,5 @@
import { useEffect, useRef, useState } from 'react'

import { useAuth } from '@redwoodjs/auth'
import {
Form,
Label,
Expand All @@ -12,6 +11,8 @@ import { navigate, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'
import { toast, Toaster } from '@redwoodjs/web/toast'

import { useAuth } from 'src/auth'

const ResetPasswordPage = ({ resetToken }: { resetToken: string }) => {
const { isAuthenticated, reauthenticate, validateResetToken, resetPassword } =
useAuth()
Expand Down
@@ -1,7 +1,6 @@
import { useRef } from 'react'
import { useEffect } from 'react'

import { useAuth } from '@redwoodjs/auth'
import {
Form,
Label,
Expand All @@ -14,6 +13,8 @@ import { Link, navigate, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'
import { toast, Toaster } from '@redwoodjs/web/toast'

import { useAuth } from 'src/auth'

const SignupPage = () => {
const { isAuthenticated, signUp } = useAuth()

Expand Down
1 change: 1 addition & 0 deletions packages/api/src/auth/decoded.ts
@@ -0,0 +1 @@
export type Decoded = Record<string, unknown> | null
Tobbe marked this conversation as resolved.
Show resolved Hide resolved