this.tokenObtained = this.tokenObtained.bind(this)
this.authenticationProps = {
usePkce: false,
authUrl: process.env.REACT_APP_AUTHORIZE_URL,
tokenUrl: process.env.REACT_APP_ACCESS_TOKEN_URL,
clientId: process.env.REACT_APP_CLIENT_ID,
clientSecret: process.env.REACT_APP_CLIENT_SECRET,
scope: ''
}
this.state = {
tokenObject: null
}
}
tokenObtained(token) {
this.setState({tokenObject: token})
}
tokenAuth(token) {
console.log('auth')
console.log(token)
}
tokenRef(token) {
console.log('ref')
console.log(token)
}
tokenRec(token) {
console.log('rec')
console.log(token)
}
tokenError(error) {
console.error(error)
}
render() {
return (
<AuthCodeProvider
history={this.props.history}
enableDebugLog={true}
authenticationRequired={false}
onReceiveAuthCode={(data) => this.tokenRec(data)}
onTokenObtained={(data) => this.tokenObtained(data)}
onGetAuthCode={(data) => this.tokenAuth(data)}
onTokenRefreshed={(data) => this.tokenRef(data)}
authenticationProps={this.authenticationProps}
>
<div>
<p>You’ll now need to connect to Hoopla to grant Microsoft Teams access to your Hoopla data.</p>
<button onClick={() => AuthCodeFunctions.doAuthorizationCodeFlow(this.authenticationProps)}>Connect To Hoopla</button>
</div>
</AuthCodeProvider>
)
}
I receive `Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.` in `tokenObtained`.