engageintellect / spatz

An opinionated template for building full-stack Svelte applications ridiculously fast. Includes auth, database, admin panel, user dashboard, themes, icons, and more.
https://spatz.engage-dev.com
MIT License
141 stars 11 forks source link

add github oauth #3

Open engageintellect opened 5 months ago

engageintellect commented 5 months ago

Docs

https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps

Example

https://github.com/rajesh6161/pocketbase-oauth-demo

all-mute commented 5 months ago

waiting for it)

I also was trying to implement server side oauth this week with nexum but still trying. I took oauth implementation from here https://github.com/Programonaut-Blog/expense-tracker but it doesn't work because if I set coockies in login/+page.server.js than I can't access them in auth/callback/[provider]/+server.js, idk why. Will try further and will notify you on succeed.

engageintellect commented 5 months ago

waiting for it)

I also was trying to implement server side oauth this week with nexum but still trying. I took oauth implementation from here https://github.com/Programonaut-Blog/expense-tracker but it doesn't work because if I set coockies in login/+page.server.js than I can't access them in auth/callback/[provider]/+server.js, idk why. Will try further and will notify you on succeed.

Cool! Let me know. Maybe if you put them in a +layout.server.js file that both /login and /auth routes are children of?

all-mute commented 5 months ago

@engageintellect

no, that won't work because in Programonaut's method we redirect user to another domain's site

Anyway, I tried few another methods and found working one. I took it from here - https://dev.to/mpiorowski/oauth2-is-so-complicated-or-90-lines-of-code-with-svelte-532.

You may check differences with your Nexum code here: https://github.com/all-mute/project-flexin/commit/5ec6be9eb20d345fd3b1f4d1bd28a73ff93ef97a#diff-0bc676db62290461fc5907797000085c1b109a7ef47c5f0751bf0ca74833fd34

Hope it will work! I will pr after some time. Should I do it into original nexum or into spatz?

engageintellect commented 4 months ago

@all-mute

Thanks for the link, I will give this a try tonight.

As far as PRs, I would say spatz as it's leaner than nexum, plus it's typescript. I would like for spatz to be a universal starting point for building apps fast. However, I'll happily merge any improvements to either nexum or spatz repos. 😊