<script src="https://sso.tapit.com.co/v3/tapit.sso.main.js"></script> <script> function configTapitSso() { // ssoApp defined! ssoApp.configApp(CONFIG_OBJECT); } </script>
<script> function configTapitSso() { ssoApp.configApp(CONFIG_OBJECT); } </script>
<button onclick="ssoApp.showApp('sign-up')">SIGN UP</button>
PAGES: ssoApp.showApp('signIn'); ssoApp.showApp('sign-up'); ssoApp.showApp('recover-password'); ssoApp.showApp('phone-verification'); METHODS: ssoApp.configApp(config) ssoApp.showApp('page') ssoApp.hideApp() ssoApp.getCustomToken(userCredential).subscribe(customToken => console.log(customToken)) ssoApp.getTermsAndConditions(userCredential) ssoApp.onFlowCompleted().subscribe(state => console.log(state)) ssoApp.logout() OBJECTS: firestore (See docs here!) auth (See docs here!)
<script> function configTapitSso() { ssoApp.onFlowCompleted().subscribe(res => { console.log(res); }); } </script>
<script> function configTapitSso() { ssoApp.auth.onAuthStateChanged(function (userCredential) { if (userCredential) { console.log(userCredential); document.getElementById('current-user').innerText = JSON.stringify(userCredential); } }); } </script> (See auth docs here!)
<button onclick="ssoApp.logout()">LOGOUT</button>
<script> function configTapitSso() { ssoApp.auth.onAuthStateChanged(function (userCredential) { if (userCredential) { ssoApp.firestore.collection('user_account_tap').doc(userCredential.uid).get() .then(function (document) { console.log(document.data()); }).catch(function (error) { console.log(error); }); } }); } </script> (See firestore docs here!)
Insert this code snippet in app.component where you're using SSO:
openSso(){ const smsStepSSO = window.localStorage.getItem('sms-step'); if (smsStepSSO && smsStepSSO !== 'phone-verified') { window.ssoApp.showApp(smsStepSSO); } } }
This variable is step name saved in localStorage in SSO web component, there are two steps:
* sms-step
There are two steps:
This step is the phone screen when application requests to user enter his phone
* 'phone-verification'
This step is when the user was able to validate his phone successful
* 'phone-verified'
This condition means that the user hasn't validated his phone successful yet.
* (smsStepSSO && smsStepSSO !== 'phone-verified')
It will open ssoApp in the pending step.
* window.ssoApp.showApp(smsStepSSO)