Added JWT decoding to Google Auth feature PR#232
Added JWT decoding to Google Auth feature PR#232twang849 wants to merge 14 commits intosupercog-ai:mainfrom
Conversation
drbrady8800
left a comment
There was a problem hiding this comment.
This looks good, exciting stuff! My biggest concerns are backwards compatibility and documentation. If some decides not to set up google auth / github auth then we shouldn't force them into a login page every time. Let's check if the env vars exist, and if they don't just behave as it was. We should also have detailed documentation on how to get the necessary env variables, where to put them, and how to get the whole auth system running. Thank you for putting this all together!
| const authOptions: NextAuthOptions = { | ||
| // Configure NextAuth to use Google as the OAuth provider | ||
| // This handles login, token exchange, and session creation | ||
| // Add GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET to .env.local |
There was a problem hiding this comment.
Lets add docs for how to set up the different auth methods. We should only show auth as an option if the relevant env vars are present in .env, otherwise it should behave as before
| Sign in with Google | ||
| </Button> | ||
| <Button className="mt-5" onClick={() => signIn('github', { callbackUrl: '/' })}> | ||
| <Image |
There was a problem hiding this comment.
Hard to see the github icon on a black button, maybe use the white github icon?
| // Login redirection logic | ||
| // Redirect if not authenticated | ||
| if (status === 'loading') { | ||
| return <div>Loading...</div>; |
There was a problem hiding this comment.
Let's use the loader to make this look nice
|
@drbrady8800 Got it, thanks for the feedback. Will implement your suggested changes as soon as possible. |
This PR builds upon #230
Changes
api.py
replace("Bearer ", "")with token = token[7:]cli.py
api/token/route.ts
app/lib/api.ts
login/page.tsx
In 'const authFetch' lib/api.ts it currently sets the JWT in local storage which might not be safe. However, not setting it requires it to fetch from /api/token each request which could be quite slow. Please let me know if either is okay/not okay, and I can find a work around.
To test the JWT logic you must run
agentic servewith--user-agents