Skip to content

Commit

Permalink
#2490: added oauth login logic back
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-may committed Jun 19, 2024
1 parent 034e267 commit 1ea441d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build-and-test-oauth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
- name: Check running containers
run: docker ps -a

- name: Caputre Hydra Oauth Service logs
- name: Capture Hydra Oauth Service logs
run: |
mkdir -p ./e2e-tests/logs
docker logs hydra > ./e2e-tests/logs/hydra.out &
Expand All @@ -166,7 +166,6 @@ jobs:
npm install
npm run backend:dropAllDBTables
npm run cyServices:start:skills-service:oauth
npm run cyServices:start:client-display:oauth
cd ..
- name: Run Cypress tests
Expand Down
2 changes: 1 addition & 1 deletion dashboard-prime/src/components/access/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ onBeforeMount(() => {
}
})
const oAuth2Login = (registrationId) => {
// this.$store.dispatch('oAuth2Login', registrationId);
authState.oAuth2Login(registrationId)
}
</script>

Expand Down
8 changes: 5 additions & 3 deletions dashboard-prime/src/stores/UseAuthState.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { computed, ref } from 'vue'
import { useRouter } from 'vue-router'
import { useRoute, useRouter } from 'vue-router'
import { defineStore } from 'pinia'
import axios from 'axios'
import { SkillsConfiguration } from '@skilltree/skills-client-js'
Expand All @@ -17,6 +17,7 @@ export const useAuthState = defineStore('authState', () => {
const oAuthAuth = ref(false)

const router = useRouter()
const route = useRoute()
const appConfig = useAppConfig()
const appInfoState = useAppInfoState()

Expand Down Expand Up @@ -95,8 +96,9 @@ export const useAuthState = defineStore('authState', () => {
}
const oAuth2Login = (oAuthId) => {
setOauth2AuthUser()
const { redirect } = router.currentRoute.query
window.location = `/oauth2/authorization/${encodeURIComponent(oAuthId)}${redirect ? `?skillsRedirectUri=${redirect}` : ''}`
const redirect = route.query.redirect
const newLocation = `/oauth2/authorization/${encodeURIComponent(oAuthId)}${redirect ? `?skillsRedirectUri=${redirect}` : ''}`
window.location = newLocation
}
const restoreSessionIfAvailable = () => {
setRestoringSession(true)
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"backend:start:verifyEmail:ci": "mkdir -p ./logs && npm run backend:start:verifyEmail > ./logs/skills-service.out &",
"backend:start:oauth:ci": "mkdir -p ./logs && npm run backend:start:oauth > ./logs/skills-service.out &",
"backend:start:rabbitmq:ci": "mkdir -p ./logs && npm run backend:start:rabbitmq > ./logs/skills-service.out &",
"backend:waitToStart": "npx wait-on -t 160000 http://localhost:8080",
"backend:waitToStart": "echo \"Started waiting for skills-service at[$(date)]\" && npx wait-on -t 160000 http://localhost:8080",
"backend:resetDb": "export PGPASSWORD=skillsPassword && psql -U postgres -h $npm_package_config_dbHost -d $npm_package_config_dbName -f ./cypress/db/reset.sql",
"backend:clearDb": "export PGPASSWORD=skillsPassword && psql -U postgres -h $npm_package_config_dbHost -d $npm_package_config_dbName -f ./cypress/db/clear.sql",
"backend:setupInviteOnly": "export PGPASSWORD=skillsPassword && psql -U postgres -h $npm_package_config_dbHost -d $npm_package_config_dbName -f ./cypress/db/createInviteOnlyProject.sql",
Expand Down

0 comments on commit 1ea441d

Please sign in to comment.