We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
incorrect authentication error when RBAC is not sufficient
Create a simple WunderGraph application from template and use open id connect auth provider
Operation
query @rbac(requireMatchAll: [tester,admin]) { findUsers: db_findManyuser { id email name } }
create a hook in wundergraph.server.ts
export default configureWunderGraphServer<HooksConfig, InternalClient>((serverContext) => ({ hooks: { authentication: { mutatingPostAuthentication: async (user) => { return { status: "ok", user: { ...user, roles: [ "tester", ] } } } }, queries: {}, mutations: {}, }, graphqlServers: [], }));
index.tsx
import { NextPage } from 'next'; import styles from '../styles/Home.module.css'; import { AuthProviders, useQuery, useWunderGraph, withWunderGraph } from '../components/generated/nextjs'; const Home: NextPage = () => { const {result: test} = useQuery.Test(); const {user, login, logout} = useWunderGraph(); return ( <div className={styles.container}> <button onClick={() => login(AuthProviders.storeo)}>Login</button> <button onClick={() => logout({ logout_openid_connect_provider: true })}>Logout </button> <h1 className={styles.title}>Hello WunderGraph! {user?.user_id}</h1> {test.status === "ok" && test.data.findUsers.length !== 0 && ( <div> {test.data.findUsers.map(message => { return (<div key={message.id}> <p> id: {message.id}, email: {message.email}, name: {message.name} </p> </div>) })} </div> )} {test.status === "error" && ( <div> {test.errors.map(value => { return (<div key={value.message}> <p> message: {value.message}, path: {value.path} </p> </div>) })} </div> )} </div> ); }; export default withWunderGraph(Home);
Actual error message:
Unexpected token u in JSON at position 0
The error message should be Access denied or something related to exact problem
Access denied
Version: 0.90.32 Commit: 386a3d4b66204411dc89da6919aad0bebe524657 Date: 2022-06-06T12:21:43Z BuiltBy: ci
The text was updated successfully, but these errors were encountered:
Your observation is correct, this needs fixing. Putting it on the backlog.
Sorry, something went wrong.
Fixed with @wundergraph/nextjs@0.0.28
No branches or pull requests
Bug description
incorrect authentication error when RBAC is not sufficient
How to reproduce
Create a simple WunderGraph application from template and use open id connect auth provider
Operation
create a hook in wundergraph.server.ts
index.tsx
Actual error message:
Expected behavior
The error message should be
Access denied
or something related to exact problemWunderGraph information
Environment & setup
WunderCtl Version
The text was updated successfully, but these errors were encountered: