diff --git a/.env b/.env index 961fa55..d22c9ef 100644 --- a/.env +++ b/.env @@ -1,3 +1,6 @@ -CLIENT_ID=2cfd2feb1cc7af2ff375 -CLIENT_SECRET=03e0b1bb543e0568f9cc40cec9876ca70684a4be +CLIENT_ID=dc330d7fe9904f7dfcd8 +CLIENT_SECRET=838495f0bc343f514832b019f4610a5ecf32922b VUE_APP_CLIENT_ID=$CLIENT_ID +VUE_APP_CLIENT_SECRET=$CLIENT_SECRET +CALL_BACK=http://localhost:8080/callback +VUE_APP_CALL_BACK=$CALL_BACK \ No newline at end of file diff --git a/40-create-ghcred.sh b/40-create-ghcred.sh index 1838698..f045e4d 100755 --- a/40-create-ghcred.sh +++ b/40-create-ghcred.sh @@ -4,4 +4,5 @@ cat </GH_OAUTH_CLIENT.conf set @CLIENT_ID $CLIENT_ID; set @CLIENT_SECRET $CLIENT_SECRET; +set @CALL_BACK $CALL_BACK EOT \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 065b852..2f08c35 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM node:latest as builder WORKDIR /usr/app COPY . . -RUN echo "VUE_APP_CLIENT_ID=$CLIENT_ID" >.env.development.local +#RUN echo "VUE_APP_CLIENT_ID=$CLIENT_ID" >.env.development.local RUN npm i --legacy-peer-deps && npm run build diff --git a/package-lock.json b/package-lock.json index 70679ad..4db1718 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "@recogito/annotorious-openseadragon": "^2.7.6", "@vue/vue3-jest": "^29.2.1", "core-js": "^3.6.5", + "dotenv": "^16.3.1", "js-base64": "^3.7.5", "octokit": "^2.0.14", "openseadragon": "^3.0.0", @@ -6871,6 +6872,15 @@ "node": ">=8" } }, + "node_modules/@vue/cli-service/node_modules/dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/@vue/cli-service/node_modules/fast-glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", @@ -10161,12 +10171,14 @@ "dev": true }, "node_modules/dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", - "dev": true, + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", "engines": { - "node": ">=10" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" } }, "node_modules/dotenv-expand": { @@ -26928,6 +26940,12 @@ "path-type": "^4.0.0" } }, + "dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "dev": true + }, "fast-glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", @@ -29618,10 +29636,9 @@ } }, "dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", - "dev": true + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==" }, "dotenv-expand": { "version": "5.1.0", diff --git a/package.json b/package.json index 861f08a..3b0cde2 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@recogito/annotorious-openseadragon": "^2.7.6", "@vue/vue3-jest": "^29.2.1", "core-js": "^3.6.5", + "dotenv": "^16.3.1", "js-base64": "^3.7.5", "octokit": "^2.0.14", "openseadragon": "^3.0.0", diff --git a/src/store/call_back.js b/src/store/call_back.js new file mode 100644 index 0000000..0b42a52 --- /dev/null +++ b/src/store/call_back.js @@ -0,0 +1,2 @@ +const CALL_BACK = process.env.VUE_APP_CALL_BACK +export default CALL_BACK \ No newline at end of file diff --git a/src/store/client_id.js b/src/store/client_id.js index f5e337b..d2701a8 100644 --- a/src/store/client_id.js +++ b/src/store/client_id.js @@ -1,2 +1,2 @@ const CLIENT_ID = process.env.VUE_APP_CLIENT_ID -export default CLIENT_ID \ No newline at end of file +export default CLIENT_ID \ No newline at end of file diff --git a/src/store/client_secret.js b/src/store/client_secret.js new file mode 100644 index 0000000..f9cf1e6 --- /dev/null +++ b/src/store/client_secret.js @@ -0,0 +1,5 @@ +// const CLIENT_SECRET = process.env.VUE_APP_CLIENT_SECRET +// console.log("this is a client secret " + process.env.VUE_APP_CLIENT_SECRET) +// export default CLIENT_SECRET +const CLIENT_SECRET = process.env.VUE_APP_CLIENT_SECRET +export default CLIENT_SECRET \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index c97d4f0..7db3dd3 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -8,6 +8,8 @@ import { Octokit } from '@octokit/rest' //import axios from 'axios'; //import qs from 'query-string'; import CLIENT_ID from './client_id'; +import CALL_BACK from './call_back'; +import CLIENT_SECRET from './client_secret'; import { Base64 } from 'js-base64'; const parser = new DOMParser() const serializer = new XMLSerializer() @@ -491,15 +493,18 @@ export default createStore({ // } const clientId = CLIENT_ID; - const redirectUri = 'http://localhost:8082/callback'; + const redirectUri = CALL_BACK; + const clientSecret = CLIENT_SECRET; const scope = 'user'; const query = qs.stringify({ client_id: clientId, + client_secret: clientSecret, redirect_uri: redirectUri, scope, }); + console.log("this is the client id " + clientId) window.location.href = `https://github.com/login/oauth/authorize?${query}`; },