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

Authorizer Authentication not working, not called #1203

Closed
pczern opened this issue Jan 7, 2024 · 3 comments
Closed

Authorizer Authentication not working, not called #1203

pczern opened this issue Jan 7, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@pczern
Copy link

pczern commented Jan 7, 2024

Describe the bug
Authorizer is not called, console.error does not log in verbose mode (-v)

To Reproduce
Do grafbase init
put an Authorizer in grafbase/auth/authorizer.ts

export default function ({ request }) {
  const { headers } = request
console.error('log')
return false;
}

run with grafbase dev

Expected behavior
I expected the graph to be inaccessible and the logging to occur because I have not returned group g1

export default config({
  graph: g,
  auth: {
    providers: [authorizer],
    rules: (rules) => {
      rules.groups(['g1'])
    },
  },
})

Additional context
Followed documentation from here https://grafbase.com/docs/auth/providers

@pczern pczern added the bug Something isn't working label Jan 7, 2024
@fbjork
Copy link
Member

fbjork commented Jan 10, 2024

@pczern be sure not to pass the x-api-key header when you're testing this locally (Pathfinder sends an empty one by default). Otherwise it bypasses the authorizer.

@pczern
Copy link
Author

pczern commented Jan 10, 2024

@fbjork I have created a minimal reproduction with Codesandbox

@fbjork
Copy link
Member

fbjork commented Jan 17, 2024

@pczern thanks for sending the sandbox, but it seems the be stuck when we try to access it. Mind pinging me in Discord so we can troubleshoot it together?

@fbjork fbjork closed this as completed May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants