From 0812507b9e7ec751a4947a4a493b1d1a11260d1d Mon Sep 17 00:00:00 2001 From: enahum Date: Mon, 20 Mar 2017 16:47:19 -0300 Subject: [PATCH] Fix SAML login with OneLogin (#359) --- app/scenes/saml/saml.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/scenes/saml/saml.js b/app/scenes/saml/saml.js index 7fbd4c9df..348e8a56b 100644 --- a/app/scenes/saml/saml.js +++ b/app/scenes/saml/saml.js @@ -8,6 +8,7 @@ import { } from 'react-native'; import CookieManager from 'react-native-cookies'; +import Client from 'mattermost-redux/client'; export default class Saml extends PureComponent { static propTypes = { @@ -27,16 +28,19 @@ export default class Saml extends PureComponent { onNavigationStateChange = (navState) => { const {url} = navState; - if (url.includes('/login/sso/saml') && url.includes('mobile')) { + + if (url.includes('/login/sso/saml')) { CookieManager.get(this.props.serverUrl, (err, res) => { const token = res.MMAUTHTOKEN; - const { - handleSuccessfulLogin, - setStoreFromLocalData, - goToLoadTeam - } = this.props.actions; if (token) { + const { + handleSuccessfulLogin, + setStoreFromLocalData, + goToLoadTeam + } = this.props.actions; + + Client.setToken(token); handleSuccessfulLogin(). then(setStoreFromLocalData.bind(null, {url: this.props.serverUrl, token})). then(goToLoadTeam);