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

Can't use client #69

Open
niskah-media opened this issue Oct 24, 2023 · 1 comment
Open

Can't use client #69

niskah-media opened this issue Oct 24, 2023 · 1 comment

Comments

@niskah-media
Copy link

Hi, I just found your repository, it's exactly want I want to make, I'm trying to test and use client, but can't login.
When I run client, I just have a blank page and an error message in console:

TypeError: can't access property "user", r() is undefined
    g useCurrentUser.ts:4
    j home.page.tsx:6
    React 11
    289 index.tsx:10
    u (index):1
    193 main.e0fc0606.chunk.js:1
    u (index):1
    r (index):1
    t (index):1
    <anonymous> main.e0fc0606.chunk.js:1

I can see that there is dummy data for using in dev mode but receive forbidden access from server.
I there any thing I forgot to do ?

Thank you.

@niskah-media
Copy link
Author

Now I can run into Login page, I just replace useAppData() hook like this:

export const useAppData = (): typeof window.__APP_DATA__ => {
  // if (process.env.NODE_ENV === 'development') {
  //   return {
  //     user: dummyUser,
  //     currentSession: dummySessions[0].sessionId,
  //     grants: dummyGrants,
  //     appName: 'App name',
  //   } as typeof window.__APP_DATA__;
  // }
  return {} as typeof window.__APP_DATA__;
}

But now I reach a CSRF Error into server:

[Nest] 7593   - 10/24/2023, 12:50:17 PM   [ExceptionsHandler] invalid csrf token +197155ms
ForbiddenError: invalid csrf token

request:

POST /auth/login?redirect_uri=%2F HTTP/1.1
Host: localhost:3000
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/119.0
Accept: */*
Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: http://localhost:3000/auth/login
Content-Type: application/json; charset=utf-8
X-CSRF-TOKEN: {{csrfToken}}
Content-Length: 63
Origin: http://localhost:3000
Connection: keep-alive
Cookie: G_ENABLED_IDPS=google; _csrf=z-yaFPT1C-3PHeq3yrnscE0M
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Pragma: no-cache
Cache-Control: no-cache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant