I’m a NextJS user; I started trying to use the 8base SDK but backed away for the reasons you listed. In the end I just used the auth0-js package directly and wrote my own auth callback handler. It’s fairly trivial, but you’ll need to implement storage etc. I just write the token to localStorage, then load it back into Apollo on page mount.
Yeah I’m finding a nice experience using this Nextjs official Nextjs + Apollo example with no 8base libraries. That starter seems to be pretty nice: server- and client-side graphql cacheing via Apollo (if you’re using Nextjs and server-side rendering. UPDATE: I may be wrong on the client-side GraphQL cacheing out of the box with that starter? But should be possible with some tweaks. Plus some other Apollo things like pulling out the “detail-level item” cache from the “list of items” cache and pre-fecthing.) THEN will add in auth.
Use your Create React App / Nextjs / Gatsby / Vue / Nuxt / PHP / Rails / React Native or whatever framework + Apollo Boost or Apollo client and no 8base libraries and access that public data. The only 8base config = link to your 8base graphql api.
Once that’s done, THEN, for auth, add roles & permissions on the data and consider adding 8base Auth or Auth0 or other auth service and its client sdk.
Then dive into 8base CLI tool, serverless functions etc…
How did you set up your authorization with NextJS and 8Base/Auth0? Did you do what @gcpantazis did above with auth-js and your own callback handler + local storage? Or something else. Thanks.
Having some trouble getting NextJS/Auth0/8Base setup
So if you just get the Token back from Auth0, it will work when you pass that to 8Base? I am not an expert in authorization but it seems like the token would somehow have to go through 8Base.
Also could you explain a little more what you had to do in the custom auth callback handler? Is it just getting the token from auth-js and then storing it on localStorage?
I often hear that storing JWT tokens in localstorage is extremely insecure and prone to XSS attack. And unless I’m mistaken, the official 8base React starter app also stores the Auth0 token in localstorage?
Hey @hello - you’re that that there are concerns around XSS attacks when storing idTokens in localStorage - regardless of it being an extremely widespread practice.
Are there security best practices beyond just having an HTTP cookie? Does 8Base support refresh tokens or HttpOnly cookies that reduce the vulnerabilities of standard cookie-based approaches? Thanks!