Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit df5e744

Browse files
fix: add process vite fix, add debug info
1 parent b6a7aad commit df5e744

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ Set `VITE_AUTH0_MULTI_TENANT_MODE=true` in `.env`
4949

5050
## Usage
5151

52+
### vite.config.ts/js
53+
54+
There's an issue with vite throwing `process` is undefined errors when the
55+
session is loaded on the client. To fix this, add the following to your
56+
`vite.config.ts/js`:
57+
58+
```js
59+
define: {
60+
'process.env': process.env
61+
},
62+
```
63+
5264
### root.jsx / .tsx
5365

5466
In `root.tsx` to enforce authentication on all pages:

src/api/callback.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,16 @@ export default async function get(request) {
6969
redirectUrl
7070
)
7171

72+
if (process.env.DEBUG === 'true') {
73+
console.log('auth0FetchOAuthToken')
74+
console.log(jsonAuthToken)
75+
}
76+
7277
const userInfo = await auth0UserInfo(jsonAuthToken.access_token)
78+
if (process.env.DEBUG === 'true') {
79+
console.log('auth0UserInfo')
80+
console.log(userInfo)
81+
}
7382
if (userInfo === undefined) {
7483
return new Response(JSON.stringify({ error: 'unauthorized' }), {
7584
status: 401

0 commit comments

Comments
 (0)