assemblee-virtuelle / assemblee-virtuelle/website

Add a OIDC login

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
1
Forks
3
PR merge metrics
No merged PRs in 30d

Description

OIDC login is not really useful at the moment, because we cannot do anything with tokens returned by a Keycloak provider. But once ActivityPods 2.0 will be released with a full OIDC provider, the following may be useful:

Add `auth-astro` integration to astro.config.mjs like this:

```js
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import auth from "auth-astro";
import node from "@astrojs/node";

// https://astro.build/config
export default defineConfig({
site: 'https://example.com',
integrations: [mdx(), sitemap(), auth()],
output: 'server',
adapter: node({
mode: "standalone"
})
});
```

Create a auth.config.js file with this content:

```js
import Keycloak from '@auth/core/providers/keycloak';
import { loadEnv } from 'vite';

const env = loadEnv('production', process.cwd(), '');

export default {
providers: [
Keycloak({
clientId: env.OIDC_CLIENT_ID,
clientSecret: env.OIDC_CLIENT_SECRET,
issuer: env.OIDC_ISSUER,
// https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/oauth.ts#L145-L152
// profile(profile) {
// console.log('profile', profile)
// return {}
// },
})
],
};
```

The Header component can look like this:

```astro
---
import HeaderLink from './HeaderLink.astro';
import { SITE_TITLE } from '../consts';
import { SignIn, SignOut } from 'auth-astro/components'
import { getSession } from 'auth-astro/server';
const session = await getSession(Astro.request);
---


{SITE_TITLE}



```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing astro.config.mjs and the proposed auth.config.js, then inspect the Header component and the existing Astro server setup. Configure the Keycloak provider with the OIDC environment variables, expose sign-in/sign-out and session display in the header, and verify that the website can authenticate and use the returned session.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
authentication, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.