react-keycloak-context
A Keycloak provider for React
Table of Contents
Usage
const keycloakConfig = realm: 'master' clientId: 'example' url: 'https://foobarbaz.com/auth' 'ssl-required': 'external' 'public-client': true 'confidential-port': 0 static async { let pageProps = {} if ComponentgetInitialProps pageProps = await Component return pageProps } { console } { const Component pageProps = thisprops return <Container> <Head> <title>Example project</title> </Head> <KeycloakProvider initOptions= onLoad: 'login-required' promiseType: 'native' config=keycloakConfig tokenKey='kc-token' refreshTokenKey='kc-refresh' onInit=thishandleKeycloakInit > <KeycloakConsumer> <Component keycloak=kc ...pageProps /> </KeycloakConsumer> </KeycloakProvider> </Container> }
Install
This project uses node and npm.
$ npm install react-keycloak-context$ # OR $ yarn add react-keycloak-context
Contribute
- Fork it and create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am "Add some feature"
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
License
MIT © [object Object]