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

useAuth does not check for reference cookie #1838

Open
1 task done
blakewilson opened this issue Mar 8, 2024 · 1 comment
Open
1 task done

useAuth does not check for reference cookie #1838

blakewilson opened this issue Mar 8, 2024 · 1 comment
Labels

Comments

@blakewilson
Copy link
Contributor

Description

After #1740, useAuth should not invoke the token endpoint on every request. This succeeds on default preview behavior (see this code), but when using useAuth, this behavior is still occurring.

Steps to reproduce

  1. Clone the custom-toolbar example project
    npx create-next-app \
     -e https://github.com/wpengine/faustjs/tree/canary \
     --example-path examples/next/custom-toolbar \
     --use-npm
  2. Install the canary packages (since the work from Only request token endpoint initially, then use a cookie to determine if there is an authenticated user #1740 hasn't been released yet): npm install @faustwp/core@canary @faustwp/cli@canary
  3. Open the developer tools and look at the network log
  4. Notice when you visit the homepage the token endpoint is still being requested (this is because the toolbar example uses the useAuth hook

Additional context

We need to check within the useAuth hook for the reference cookie, and if its value is 0, return early.

@faustwp/core Version

canary

@faustwp/cli Version

canary

FaustWP Plugin Version

N/A

WordPress Version

N/A

Additional environment details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes
@blakewilson blakewilson added the bug label Mar 8, 2024
@theodesp theodesp self-assigned this Mar 19, 2024
@ChrisWiegman
Copy link
Member

As we work through our backlog, this ticket is moving out of in progress until we can properly review it.

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

No branches or pull requests

3 participants