You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[OAuth client ID credentials](https://developers.google.com/workspace/guides/create-credentials#oauth-client-id).
83
+
- While creating OAuth client ID credentials, set the redirect URL to any port of localhost.
84
+
- Save the downloaded JSON file as `credentials.json` in the project's root directory.
85
+
- Then enable [Gmail API](https://console.cloud.google.com/apis/library/gmail.googleapis.com) to enable receiving OTP.
86
+
86
87
<palign="right">(<ahref="#top">back to top</a>)</p>
87
88
88
89
### Installation
@@ -92,28 +93,30 @@ _Now that the environment has been set up and configured to properly compile and
92
93
<!-- UPDATE -->
93
94
94
95
1. Clone the repository
95
-
```sh
96
-
git clone https://github.com/metakgp/heimdall.git
97
-
```
96
+
```sh
97
+
git clone https://github.com/metakgp/heimdall.git
98
+
```
98
99
2. Configure environment variables
99
-
```sh
100
-
cd ./heimdall
101
-
cp .env.template .env
102
-
```
103
-
Choose a strong JWT_SECRET_KEY and edit the `.env` file accordingly.
100
+
101
+
```sh
102
+
cd ./heimdall
103
+
cp .env.template .env
104
+
```
105
+
106
+
Choose a strong JWT_SECRET_KEY and edit the `.env` file accordingly.
104
107
105
108
3. Install Go dependencies
106
-
```sh
107
-
go mod download
108
-
```
109
+
```sh
110
+
go mod download
111
+
```
109
112
4. Compile the code
110
-
```sh
111
-
go build
112
-
```
113
+
```sh
114
+
go build
115
+
```
113
116
5. Execute the script
114
-
```sh
115
-
./heimdall
116
-
```
117
+
```sh
118
+
./heimdall
119
+
```
117
120
118
121
When prompted to enter the authorization code, visit the link provided in the terminal, which will redirect to localhost. Then, inspect the URL after redirection and copy the string after `code=` and paste it in the terminal. This will create a `token.json` file. You need to create this token only once, and it will be valid for 6 months.
119
122
@@ -146,13 +149,14 @@ While just doing this would have sufficed, we do not know whether these Public I
> The above functionality is implemented in the main (`/`) route
154
158
155
-
When the user enters the institute mail ID, an OTP is sent (`/get-otp`) and once they verify the OTP (`/verfiy-otp`), a cookie is generated which is valid only for the domain `*.metakgp.org` (including its subdomains like `naarad.metakgp`, `gyft.metakgp`, etc.). This cookie contains the user's institute mail ID, which can be retrieved from it.
159
+
When the user enters the institute mail ID, an OTP is sent (`/get-otp`) and once they verify the OTP (`/verfiy-otp`), a cookie is generated which is valid only for the domain `*.metakgp.org` (including its subdomains like `naarad.metakgp`, `gyft.metakgp`, etc.). This cookie contains the user's institute mail ID, which can be retrieved from it.
156
160
157
161
The endpoint `/validate-jwt` validates the cookie that is sent along with the request to access internal services like Naarad and Gyft. Once the user's mail ID is verified, they can access the above services, making sure that they are accessible only to institute students.
158
162
@@ -164,14 +168,15 @@ Well yes. Provided it has a backend server. This cannot be done in the front-end
164
168
165
169
Also, one service - to protect all of our services. Reducing code repetition and easy integration.
166
170
167
-
<palign="right">(<ahref="#top">back to top</a>)</p>
171
+
<p align="right">(<a href="#top">back to top</a>)</p>
0 commit comments