Skip to content

Commit

Permalink
fix import issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ben9583 committed Oct 5, 2023
1 parent 00a1c45 commit 21c5391
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 6 additions & 1 deletion gatsby-browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ export const wrapRootElement: GatsbyBrowser["wrapRootElement"] = ({
refreshInterval: 15 * 1000, // 15 seconds
}

const config = {
...keycloakConfig,
redirect_uri: window.location.origin,
} as typeof keycloakConfig

return (
<SWRConfig value={options}>
<AuthProvider {...keycloakConfig}>{element}</AuthProvider>
<AuthProvider {...config}>{element}</AuthProvider>
</SWRConfig>
)
}
10 changes: 2 additions & 8 deletions src/utils/keycloak.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { type KeycloakTokenParsed } from "keycloak-js"
import { type AuthProviderProps } from "react-oidc-context"
import config from "../../gatsby-config"

const siteUrl = config.siteMetadata!["siteUrl"] as string

const keycloakConfig: AuthProviderProps = {
const keycloakConfig = {
authority: "https://auth.ocf.berkeley.edu/auth/realms/ocf",
client_id: "ocfstatic",
redirect_uri: `${
typeof window !== "undefined" ? window.location.href : siteUrl
}/`,
}
} as AuthProviderProps

export default keycloakConfig

Expand Down

0 comments on commit 21c5391

Please sign in to comment.