Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

add support for denoland/deno_kv_oauth #133

Closed
adoublef opened this issue Jul 28, 2023 · 7 comments · Fixed by #145
Closed

add support for denoland/deno_kv_oauth #133

adoublef opened this issue Jul 28, 2023 · 7 comments · Fixed by #145
Labels
🦕 deno feature A new amazing feature.
Milestone

Comments

@adoublef
Copy link

I am trailing this out and attempting to use denoland/deno_kv_oauth as an oauth provider. Seems that I am able to get passed the signIn leg of the auth_code flow, however I am not able to get a response from the callback 

I think in the discord you mentioned that ctx.req.raw is the underlining request however that seems to not be working so will be trying to look into that.

server.get("/signin", async (ctx) => {
    console.log("signIn::before");
    const response = await signIn(ctx.req.raw, oauth2Client);
    console.log("signIn::after");
    ctx.res.redirect(response.headers.get("location")!, Status.Found);
});

server.get("/callback", async (ctx) => {
    console.log("callback::before");
    const { response } = await handleCallback(ctx.req.raw, oauth2Client);
    console.log("callback::after");
    ctx.res.redirect(response.headers.get("location")!, Status.Found);
});

and the log is showing

Listening on http://localhost:3000/
signIn::before
signIn::after
callback::before
@boywithkeyboard
Copy link
Owner

@adoublef as cheetah is built for Cloudflare Workers and Deno, I think it would be a great addition to add a alternative to it to the accessories.

What would you think of such a module with a similar API to Deno's version, but with support for various other storage mechanisms (e.g. Deno/Cloudflare KV, Redis, etc.).

@adoublef
Copy link
Author

I think that would be really good as I too would like a version that was a bit more open. I think the issue I am seeing is that the cookies may not be being set. And unsure if that is due to how I am doing the redirect that you suggested before.

@boywithkeyboard
Copy link
Owner

@adoublef you'd need to re-set the set-cookie header.

I'll try to write such a accessory after my vacation as mentioned already in cheetah's Discord.

@adoublef
Copy link
Author

adoublef commented Jul 28, 2023

yh that's what I am attempting to do now, going to try work around their API then once that is done can see if there is a cleaner way to make it a bit more generic.

Seems to have worked for now

@boywithkeyboard boywithkeyboard added this to the v1.3 milestone Aug 5, 2023
@boywithkeyboard
Copy link
Owner

@adoublef this feature will be part of v1.3 as I want to make more frequent releases and therefore i can't include too many new features or changes.

I also need to think a little bit more about how I should implement it to avoid future breaking changes and make it as simple as possible without degrading safety.

@adoublef
Copy link
Author

adoublef commented Aug 6, 2023

That's all good. I've been looking into Hono as they are another framework that happens to also wrap the native request to see what difference there are as to why my callback failed here. Looking forward to the v1.3 release

@boywithkeyboard
Copy link
Owner

@adoublef I hope we don't lose you to the competition! xD

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🦕 deno feature A new amazing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants