WIP
40d3b13a
3 file(s) · +12 −5
| 1 | + | <!doctype html><title>Redirecting to: https://stevedylan.dev/auth/auth-code-error</title><meta http-equiv="refresh" content="2;url=https://stevedylan.dev/auth/auth-code-error"><meta name="robots" content="noindex"><link rel="canonical" href="https://stevedylan.dev/auth/auth-code-error"><body> <a href="https://stevedylan.dev/auth/auth-code-error">Redirecting from <code>/auth/callback</code> to <code>https://stevedylan.dev/auth/auth-code-error</code></a></body> |
| 2 | 2 | ||
| 3 | 3 | export function SignInButton() { |
|
| 4 | 4 | async function signInWithGithub() { |
|
| 5 | - | const { data, error } = await supabase.auth.signInWithOAuth({ |
|
| 5 | + | await supabase.auth.signInWithOAuth({ |
|
| 6 | 6 | provider: "github", |
|
| 7 | + | options: { |
|
| 8 | + | redirectTo: "https://stevedylan.dev/auth/callback", |
|
| 9 | + | }, |
|
| 7 | 10 | }); |
|
| 8 | - | if (error) { |
|
| 9 | - | alert(error); |
|
| 10 | - | } |
|
| 11 | - | console.log(data); |
|
| 12 | 11 | } |
|
| 13 | 12 | ||
| 14 | 13 | return ( |
| 1 | + | --- |
|
| 1 | 2 | import { createServerClient, parseCookieHeader } from "@supabase/ssr"; |
|
| 2 | 3 | import { type APIRoute } from "astro"; |
|
| 3 | 4 | ||
| 34 | 35 | // return the user to an error page with instructions |
|
| 35 | 36 | return redirect("/auth/auth-code-error"); |
|
| 36 | 37 | }; |
|
| 38 | + | --- |
|
| 39 | + | ||
| 40 | + | <script> |
|
| 41 | + | // This script will run on the client side to handle the redirect |
|
| 42 | + | window.location.href = new URL(window.location.href).searchParams.get("next") || "/"; |
|
| 43 | + | </script> |
|