Skip to content

Commit

Permalink
wind2
Browse files Browse the repository at this point in the history
  • Loading branch information
dtinth committed May 17, 2024
1 parent c34a9b5 commit ec84ab3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"verror": "^1.10.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"start": "env NODE_OPTIONS=--openssl-legacy-provider react-scripts start",
"build": "env NODE_OPTIONS=--openssl-legacy-provider react-scripts build",
"test": "env NODE_OPTIONS=--openssl-legacy-provider react-scripts test",
"eject": "env NODE_OPTIONS=--openssl-legacy-provider react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
4 changes: 2 additions & 2 deletions src/core/app/AuthenticationWall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useFirebaseAuth, useFirebaseDatabase } from 'fiery'
import firebase from 'firebase'
import { Box, Heading, Paragraph } from 'grommet'
import React, { ReactNode, useEffect, useState } from 'react'
import { ActionButton, Loading, handlePromise, ConnectorType } from '../ui'
import { ActionButton, ConnectorType, Loading, handlePromise } from '../ui'
import { signInIntegrationCallbacks } from './SignInIntegrationCallbacks'

export function AuthenticationWall(props: {
Expand Down Expand Up @@ -75,7 +75,7 @@ function PleaseSignIn() {
window.location.href =
'https://eventpop-ticket-gateway.vercel.app/redirect.html?' +
[
`eventId=9912`,
`eventId=26957`,
`target=${encodeURIComponent(window.location.host)}`,
`hash=${encodeURIComponent(window.location.hash)}`,
].join('&')
Expand Down
17 changes: 12 additions & 5 deletions src/core/app/EventpopIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ export function checkHashForEventpopTicketToken() {
const idToken = sessionStorage.eventpopTicketToken
delete sessionStorage.eventpopTicketToken
signInIntegrationCallbacks.push(async () => {
const result = await firebase
.functions()
.httpsCallable('authenticateEventpopTicket')({ idToken })
if (!result.data.token) {
const result = await fetch(
'https://auden-eventpop.vercel.app/api/eventpop',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ idToken }),
}
).then((res) => res.json())
if (!result.token) {
throw new Error('Did not receive a token')
}
await firebase.auth().signInWithCustomToken(result.data.token)
await firebase.auth().signInWithCustomToken(result.token)
})
}
}

0 comments on commit ec84ab3

Please sign in to comment.