react-login-apim
v1.0.1
Published
React login for Gravitee AM
Downloads
3
Readme
react-login-apim
React login for Gravitee AM
Install
npm install --save react-login-apim
Usage
import React, { Component } from 'react'
import { GraviteeLoginComponent } from 'react-login-apim'
import 'react-login-apim/dist/index.css'
const custom_logout_btn = () => {
return (
<div style={{
padding:10,
border:'1px solid red',
width:150, borderRadius:5, color:'red', textAlign:'center', cursor:'pointer'}} > Logout </div>
)
}
class Example extends Component {
render() {
return <GraviteeLoginComponent
customButton={custom_logout_btn}
devmode={false}
devmode_data={{}}
window={window}
graviteeserver="<your gravitee server host url>"
graviteedomaine="<your gravitee domaine>"
clientid="<your gravitee client id>"
redirecturl="<the return url after gravitee login on your site>"
roles={['<list of expedted role to be checked for the connected user>']}
bearer="<Bearer authorization_code >"
logoutCallback = {() => {console.log('Logout callback')}}
setReceivedToken = {(token) => {
setUserToken(token)
}}>
</GraviteeLoginComponent>
}
}
properties definitions
| Props | type | comment |
| ------ | ------ | ------ |
| window
| required | required by the module, must be binded to window component |
| setReceivedToken
| required |binded method call to send to the parent the received token |
| logoutCallback
| required |binded method call on logout |
| graviteeserver
| required | gravitee host url |
| graviteedomaine
| required |gravitee domaine, possible value 'external' or 'internal' |
| clientid
| required |the Api client id shrared by gravitee |
| redirecturl
| required |the redirect url defined on gravite APIM |
| roles
| optional |roles to be checked on user loggin |
| bearer
| required | the bearer value available on gravitee |
| devmode
| optional | boolean value to activate the redirect on loading. default value is true to see the logout button |
| devmode_data
| optional | json object to return in devmode to simulate the service response combine with devmode=true |
License
MIT © Thylou