Skip to content

How to reuse Keycloak session/token in embedded React SPA via oidc-spa? #84

@alefduarte

Description

@alefduarte

I’m working with a WPF application that embeds a React client inside a WebView.
The WPF app authenticates with Keycloak directly, and I would like to reuse the same authentication session/token inside the embedded React client.

With a previous provider, our workaround was:

  1. The WPF app generated a temporary token after authenticating.
  2. It loaded the React client in the WebView, passing the token as a query parameter.
  3. On the React side, the client exchanged that temporary token with the authentication service to obtain a valid JWT token.

Now I would like to migrate this flow to oidc-spa.

Question

  • What is the recommended approach with oidc-spa to support this scenario?
  • Is there a standard way to initialize the SPA client with a token obtained externally (from the WPF host)?
  • Or should the React client always start its own OIDC flow (authorization code with PKCE), even when embedded in a native host?

Notes

I’m not entirely sure if this is more related to Keycloak configuration than to oidc-spa, but the end goal is to integrate it properly with the OIDC standard using this library.

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions