Skip to content

Commit

Permalink
add the correct configuation for authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
hizclick committed Sep 27, 2023
1 parent 18aec22 commit 3c94ae7
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 14 deletions.
7 changes: 5 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions 40-create-ghcred.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
cat <<EOT | envsubst | tr '@' '$' >/GH_OAUTH_CLIENT.conf
set @CLIENT_ID $CLIENT_ID;
set @CLIENT_SECRET $CLIENT_SECRET;
set @CALL_BACK $CALL_BACK
EOT
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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


Expand Down
35 changes: 26 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions src/store/call_back.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const CALL_BACK = process.env.VUE_APP_CALL_BACK
export default CALL_BACK
2 changes: 1 addition & 1 deletion src/store/client_id.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const CLIENT_ID = process.env.VUE_APP_CLIENT_ID
export default CLIENT_ID
export default CLIENT_ID
5 changes: 5 additions & 0 deletions src/store/client_secret.js
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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}`;
},

Expand Down

0 comments on commit 3c94ae7

Please sign in to comment.