Svelte OIDC Component
The svelte-oidc is an OIDC Client Component for Svelte. It allows developers to easily integrate OpenID Connect (OIDC) authentication into their Svelte applications. The component supports client-side authentication and can be used with popular identity providers such as Okta, Auth0, KeyCloak, IdentityServer, and Ory.
To install the svelte-oidc package, use the following command:
npm install @dopry/svelte-oidc
In your Svelte application, import the required components as needed. For example, to use the OidcContext component:
<script>
import { OidcContext } from '@dopry/svelte-oidc';
// Your component logic
</script>
<OidcContext issuer="https://example.com" client_id="your_client_id" redirect_uri={window.location.href} />
For SSR applications, ensure that the authentication is handled on the client side and not rendered server side.
The svelte-oidc component provides an easy-to-use solution for integrating OIDC authentication in Svelte applications. It allows developers to work with different identity providers without dealing with vendor-specific assumptions, enabling smoother migration between providers. With its various components and stores, developers can easily handle authentication, access tokens, user info, and more.