// PantheraHive Bridge v12 — resume-builder (function() { var params = new URLSearchParams(window.location.search); var hiveToken = params.get('hiveToken'); var ssoToken = params.get('sso_token'); // Also check hash if (!hiveToken && !ssoToken && window.location.hash) { var hp = new URLSearchParams(window.location.hash.split('?')[1] || ''); hiveToken = hp.get('hiveToken'); ssoToken = hp.get('sso_token'); } // sso_token is already a backend JWT (from GET /sso redirect) if (ssoToken) { console.log('[PantheraHive] Bridge v12 — sso_token detected, storing directly'); try { localStorage.setItem('token', ssoToken); } catch(e) {} try { localStorage.setItem('auth_token', ssoToken); } catch(e) {} try { var payload = JSON.parse(atob(ssoToken.split('.')[1].replace(/-/g,'+').replace(/_/g,'/'))); if (payload.email) { localStorage.setItem('user_email', payload.email); localStorage.setItem('user', JSON.stringify({ email: payload.email, sso: true })); } } catch(e) {} window.history.replaceState({}, '', window.location.pathname); window.location.reload(); return; } if (!hiveToken) return; console.log('[PantheraHive] Bridge v12 — exchanging hiveToken'); // Clear any stale tokens first try { localStorage.removeItem('token'); } catch(e) {} try { localStorage.removeItem('auth_token'); } catch(e) {} // Decode email for logging var email = ''; try { email = JSON.parse(atob(hiveToken.split('.')[1].replace(/-/g,'+').replace(/_/g,'/'))).email || ''; } catch(e) {} // Exchange hiveToken for backend JWT (synchronous) var xhr = new XMLHttpRequest(); xhr.open('POST', '/sso/exchange', false); xhr.setRequestHeader('Content-Type', 'application/json'); try { xhr.send(JSON.stringify({ token: hiveToken, appId: 'resume-builder' })); if (xhr.status === 200) { var data = JSON.parse(xhr.responseText); if (data.success && data.token) { console.log('[PantheraHive] Exchange OK for', data.user && data.user.email || email); localStorage.setItem('token', data.token); localStorage.setItem('auth_token', data.token); var ue = (data.user && data.user.email) || email; if (ue) { localStorage.setItem('user_email', ue); localStorage.setItem('user', JSON.stringify({ email: ue, sso: true })); } // Clean URL and reload so the app script picks up the new token window.history.replaceState({}, '', window.location.pathname); window.location.reload(); return; } else { console.error('[PantheraHive] Exchange failed:', data.error || 'unknown'); } } else { console.error('[PantheraHive] Exchange HTTP', xhr.status); } } catch(e) { console.error('[PantheraHive] Exchange error:', e); } // Clean URL even on failure window.history.replaceState({}, '', window.location.pathname); })();
Build your professional portfolio
Tell us a bit about yourself.
What technologies do you work with?
Your portfolio is ready. You can always add more projects and update your profile later.
Secure your account, then activate your 14-day trial with 25 total API calls.
Verify your email to unlock trial access and secure your account.
Get 14 days of access with up to 25 API calls. Perfect for evaluating the platform.
Verify a phone number for high-value trials and added account integrity.
Loading...
Loading...