Skip to content

Instantly share code, notes, and snippets.

@alicek106
Created August 21, 2020 03:45
Show Gist options
  • Save alicek106/506b162af4eabc0e5a2b88749c9f89fb to your computer and use it in GitHub Desktop.
Save alicek106/506b162af4eabc0e5a2b88749c9f89fb to your computer and use it in GitHub Desktop.
const React = require("react")
const Keycloak = require("keycloak-js")
const { KeycloakProvider } = require("@react-keycloak/web")
const keycloak = new Keycloak({
realm: 'alicek106',
url: 'https://auth.alicek106.com/auth',
clientId: 'react-frontend',
})
const Loading = () => <div>getting ready...</div>
exports.wrapRootElement = ({ element }) => {
return (
<KeycloakProvider
keycloak={keycloak}
initConfig={{
promiseType: "native",
onLoad: "check-sso",
checkLoginIframe: false,
pkceMethod: "S256",
silentCheckSsoRedirectUri:
window.location.origin + "/silent-check-sso.xhtml",
}}
LoadingComponent={<Loading />}
>
{element}
</KeycloakProvider>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment