Skip to content

Commit

Permalink
createWebHASHHistory
Browse files Browse the repository at this point in the history
  • Loading branch information
devincowan committed Nov 15, 2023
1 parent 9bdc081 commit 9c9dc73
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions app/frontend/src/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function logIn(callback) {
// alter redirect uri
const authUrl = new URL(json.authorization_url)
// const originalRedirect = authUrl.searchParams.get('redirect_uri')
authUrl.searchParams.set('redirect_uri', `${APP_URL}/auth-redirect`)
authUrl.searchParams.set('redirect_uri', `${APP_URL}/#/auth-redirect`)
window.open(
authUrl.toString(),
'_blank',
Expand All @@ -24,8 +24,8 @@ export async function logIn(callback) {
return
}

const params = new URLSearchParams(event.data)
const url = `${ENDPOINTS.authCuahsiCallback}?${params}`
const params = event.data
const url = `${ENDPOINTS.authCuahsiCallback}${params}`
await fetch(url, {credentials: 'include', mode: 'cors'})

let userInfo = await fetch(`${ENDPOINTS.userInfo}`, {
Expand Down
4 changes: 2 additions & 2 deletions app/frontend/src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'
import HelpView from '../views/HelpView.vue'
import MapView from '../views/MapView.vue'
import ApiView from '../views/ApiView.vue'

const router = createRouter({
history: createWebHistory("/domain-subsetter/"),
history: createWebHashHistory(),
routes: [
{
path: '/',
Expand Down
5 changes: 2 additions & 3 deletions app/frontend/src/views/AuthRedirectView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
<script setup>
import { onMounted } from 'vue'
import { APP_URL } from "@/constants";
import { useRoute } from 'vue-router'
onMounted(() => {
// Get a dictionary of parameters in the redirect response URL
const route = useRoute();
const params = window.location.search
// window.opener references our original window from where the login popup was opened
window.opener.postMessage(
route.query,
params,
APP_URL // Important security measure: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
);
window.close();
Expand Down

0 comments on commit 9c9dc73

Please sign in to comment.