Skip to content

Commit

Permalink
Merge pull request #63 from deepali-chavhan/develop
Browse files Browse the repository at this point in the history
fix: Added secret key in env and remove from code
  • Loading branch information
ankush-maherwal authored Sep 9, 2024
2 parents 617f968 + e921f55 commit 9062a37
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 12 deletions.
3 changes: 2 additions & 1 deletion packages/common-lib/.env.development
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
REACT_APP_OAUTH_PROXY_ENABLED=false
REACT_APP_API_URL=https://alt-dev.uniteframework.io/api/v1
REACT_APP_BASE_URL=https://alt-dev.uniteframework.io
REACT_APP_BASE_URL=https://alt-dev.uniteframework.io
REACT_APP_SECRET_KEY=9ca6e96d-f72e-4208-91f4-a2d8e681f767
3 changes: 2 additions & 1 deletion packages/common-lib/.env.production
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
REACT_APP_OAUTH_PROXY_ENABLED=false
REACT_APP_API_URL=https://alt-dev.uniteframework.io/api/v1
REACT_APP_BASE_URL=https://alt-dev.uniteframework.io
REACT_APP_BASE_URL=https://alt-dev.uniteframework.io
REACT_APP_SECRET_KEY=9ca6e96d-f72e-4208-91f4-a2d8e681f767
5 changes: 3 additions & 2 deletions packages/common-lib/src/services/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import axios from 'axios'
export function fetchToken(
authUrl: string,
username: string,
password: string
password: string,
secret_key:string
): Promise<any> {
const params = new URLSearchParams()
params.append('client_id', 'hasura-app')
params.append('username', username)
params.append('password', password)
params.append('grant_type', 'password')
params.append('client_secret', '9ca6e96d-f72e-4208-91f4-a2d8e681f767')
params.append('client_secret', secret_key)

const config = {
headers: {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/.env.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
REACT_APP_OAUTH_PROXY_ENABLED=false
REACT_APP_API_URL=https://alt-dev.uniteframework.io/api/v1
REACT_APP_BASE_URL=https://alt-dev.uniteframework.io
REACT_APP_AUTH_URL="https://alt-dev.uniteframework.io/auth/realms/hasura-app/protocol/openid-connect/token"
REACT_APP_AUTH_URL="https://alt-dev.uniteframework.io/auth/realms/hasura-app/protocol/openid-connect/token"
REACT_APP_SECRET_KEY=9ca6e96d-f72e-4208-91f4-a2d8e681f767
3 changes: 2 additions & 1 deletion packages/core/.env.production
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
REACT_APP_OAUTH_PROXY_ENABLED=false
REACT_APP_API_URL=https://alt-dev.uniteframework.io/api/v1
REACT_APP_BASE_URL=https://alt-dev.uniteframework.io
REACT_APP_AUTH_URL="https://alt-dev.uniteframework.io/auth/realms/hasura-app/protocol/openid-connect/token"
REACT_APP_AUTH_URL="https://alt-dev.uniteframework.io/auth/realms/hasura-app/protocol/openid-connect/token"
REACT_APP_SECRET_KEY=9ca6e96d-f72e-4208-91f4-a2d8e681f767
3 changes: 2 additions & 1 deletion packages/core/src/pages/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export default function Login({ swPath }) {
const result = await fetchToken(
process.env.REACT_APP_AUTH_URL,
credentials?.username,
credentials?.password
credentials?.password,
process.env.REACT_APP_SECRET_KEY
);
if (result?.data) {
let token = result.data.access_token;
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/pages/StudentLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ export default function StudentLogin({ swPath }) {
const result = await fetchToken(
process.env.REACT_APP_AUTH_URL,
credentials?.username,
credentials?.password
credentials?.password,
process.env.REACT_APP_SECRET_KEY
);

if (result?.data) {
Expand Down
3 changes: 2 additions & 1 deletion packages/student-app/.env.development
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
REACT_APP_OAUTH_PROXY_ENABLED=false
REACT_APP_API_URL=https://alt-dev.uniteframework.io/api/v1
REACT_APP_BASE_URL=https://alt-dev.uniteframework.io
REACT_APP_BASE_URL=https://alt-dev.uniteframework.io
REACT_APP_SECRET_KEY=9ca6e96d-f72e-4208-91f4-a2d8e681f767
3 changes: 2 additions & 1 deletion packages/student-app/.env.production
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
REACT_APP_OAUTH_PROXY_ENABLED=false
REACT_APP_API_URL=https://alt-dev.uniteframework.io/api/v1
REACT_APP_BASE_URL=https://alt-dev.uniteframework.io
REACT_APP_BASE_URL=https://alt-dev.uniteframework.io
REACT_APP_SECRET_KEY=9ca6e96d-f72e-4208-91f4-a2d8e681f767
2 changes: 1 addition & 1 deletion packages/student-app/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function App() {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: `client_id=hasura-app&token=${refreshToken}&client_secret=9ca6e96d-f72e-4208-91f4-a2d8e681f767`,
body: `client_id=hasura-app&token=${refreshToken}&client_secret=${process.env.REACT_APP_SECRET_KEY}`,
}
);
console.log("REFRESH check");
Expand Down
2 changes: 1 addition & 1 deletion packages/student-app/src/api's/getNewAccessToken.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const getNewAccessToken = async () => {
client_id: "hasura-app",
refresh_token: token,
grant_type: "refresh_token",
client_secret: "9ca6e96d-f72e-4208-91f4-a2d8e681f767",
client_secret: process.env.REACT_APP_SECRET_KEY,
})
);

Expand Down

0 comments on commit 9062a37

Please sign in to comment.