diff --git a/.env.example b/.env.example
index bf33140..b27bf64 100644
--- a/.env.example
+++ b/.env.example
@@ -11,6 +11,4 @@ OAUTH2__CLIENT_ID=
OAUTH2__CLIENT_SECRET=
# Userinfo route
-USERINFO__ROUTE=
-# Identifier
-USERINFO__IDENTIFIER=
\ No newline at end of file
+USERINFO__ROUTE=
\ No newline at end of file
diff --git a/src/lib/configuration.ts b/src/lib/configuration.ts
new file mode 100644
index 0000000..116f3f7
--- /dev/null
+++ b/src/lib/configuration.ts
@@ -0,0 +1,17 @@
+const configuration = {
+ oauth2: {
+ endpoints: {
+ authenticate: process.env.OAUTH2__AUTHENTICATE,
+ logout: process.env.OAUTH2__LOGOUT,
+ token: process.env.OAUTH2__TOKEN
+ },
+ client: {
+ id: process.env.OAUTH2__CLIENT_ID,
+ secret: process.env.OAUTH2__CLIENT_SECRET
+ }
+ },
+ userinfo: {
+ route: process.env.USERINFO__ROUTE
+ }
+}
+export default configuration
\ No newline at end of file
diff --git a/src/lib/index.ts b/src/lib/index.ts
index 5893a83..95d0c57 100644
--- a/src/lib/index.ts
+++ b/src/lib/index.ts
@@ -1,3 +1,28 @@
-export function userAuthorize() {
+import { redirect } from "@sveltejs/kit"
+import configuration from "./configuration"
+const states = new Map
If you'd like to set a profile picture, click here. - If logged out, you will be redirected to the OAuth2 provider of this instance. + If logged out, you will be redirected to the OIDC provider of this instance.
diff --git a/src/routes/logout/+page.server.ts b/src/routes/logout/+page.server.ts index 40f67e2..6bcf1dd 100644 --- a/src/routes/logout/+page.server.ts +++ b/src/routes/logout/+page.server.ts @@ -1,5 +1,6 @@ +import configuration from "$lib/configuration.js"; import { redirect } from "@sveltejs/kit"; export function load({}) { - throw redirect(301, "/") + throw redirect(301, configuration.oauth2.endpoints.logout) } \ No newline at end of file diff --git a/src/routes/set/+page.server.ts b/src/routes/set/+page.server.ts index 0a8b1ef..60fb579 100644 --- a/src/routes/set/+page.server.ts +++ b/src/routes/set/+page.server.ts @@ -1,4 +1,7 @@ -export function load({ cookies }) { - let token = cookies.get("accessToken") - +import {launchLogin} from "$lib" +export async function load({ request, parent }) { + //const { user } = await parent(); + let user = null + if (!user) + throw launchLogin(request) } \ No newline at end of file diff --git a/src/routes/set/+page.svelte b/src/routes/set/+page.svelte index 7a9dcf5..aa6096b 100644 --- a/src/routes/set/+page.svelte +++ b/src/routes/set/+page.svelte @@ -1,8 +1,8 @@ -- Your identifier is {data.userid}. + Your identifier is {data.user.sub}.
\ No newline at end of file