-
Notifications
You must be signed in to change notification settings - Fork 167
refactor: kv_oauth #674
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
base: main
Are you sure you want to change the base?
refactor: kv_oauth #674
Conversation
|
Thank you for the PR, @fdemir. I have to consider how we simulate a signed-in user for the tests. Please allow me some time to devise a solution to unblock this PR. |
|
@iuioiua hey i have upgraded my own project to the latest async function fakeSignIn(user: User): Promise<void> {
await createUser(user);
await kv.set(["site_sessions", user.sessionId], true);
}
so my test script become: Voila, this works like a charm. Hope this helps! Amazing project btw, saved me so much time. ❤️ |
|
Hm... That seems quite hacky. Good find, nevertheless. Let me get back to you on what we do here. |
Why do you find it hacky? What are the major issues you are having while trying to simulate user sign in? |
|
I find it hacky because it uses a barely-known KV path. I don't currently recall what the blocker was here. I'll look into this again once things calm down with |
| signIn, | ||
| signOut, | ||
| } from "kv_oauth/mod.ts"; | ||
| import { createGitHubOAuthConfig, createHelpers } from "jsr:@deno/kv-oauth"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import { createGitHubOAuthConfig, createHelpers } from "jsr:@deno/kv-oauth"; | |
| import { createGitHubOAuthConfig, createHelpers } from "@deno/kv-oauth"; |
Ditto for other imports. Please run deno add jsr:@deno/kv-oauth to add the import to the deno.json file.
| { | ||
| path: "/signin", | ||
| handler: async (req) => await signIn(req, createGitHubOAuthConfig()), | ||
| handler: async (req) => await signIn(req), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| handler: async (req) => await signIn(req), | |
| handler: (req) => signIn(req), |
Nit
| { | ||
| path: "/signout", | ||
| handler: signOut, | ||
| handler: async (req) => await signOut(req), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| handler: async (req) => await signOut(req), | |
| handler: (req) => signOut(req), |
Nit
I was trying to use the google provider and noticed that kv_oauth was old. I've upgraded it and make it easy to add new providers etc. Feel free to give feedback.