Skip to content

Commit

Permalink
Tidy login token after SSO. Closes #65.
Browse files Browse the repository at this point in the history
  • Loading branch information
gleachkr committed Sep 2, 2021
1 parent 941cc50 commit bbac880
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ class PopulusViewer extends Component {
this.loginToken = QueryParameters.get('loginToken')

if (Client.isResumable()) Client.initClient().then(this.loginHandler)
else if (this.loginToken) Client.initClient().then(_ => Client.client.loginWithToken(this.loginToken, this.loginHandler))
else this.setState({ loggedIn: false })
else if (this.loginToken) {
Client.initClient()
.then(_ => Client.client.loginWithToken(this.loginToken, this.loginHandler))
.then(_ => QueryParameters.delete('loginToken'))
} else this.setState({ loggedIn: false })
}

componentDidMount() {
Expand Down

0 comments on commit bbac880

Please sign in to comment.