-
Notifications
You must be signed in to change notification settings - Fork 28
Getting Started
Clone the SCE dev tool and follow the guide for setup: https://github.com/SCE-Development/SCE-CLI#setup
sce clone c
cd Clark
sce link c
- Install docker:
- run mongodb with:
sce run mongo
Ensure you have python3 installed and run the script with:
# if macOS or linux:
python3 setup.py
# if Windows:
python setup.pyskip the below sections, just do
sce run c
the frontend will be visible at both http://localhost and http://localhost:3000. the backend can be seen at http://localhost:8080
To simply run the application's frontend, paste the below command into your terminal.
npm run start
Shortly after, a window in your browser will open with the website on http://localhost:3000.
In another new terminal window or tab, run the application with the command below:
npm run server
In yet another new terminal window or tab, run the application with the command below:
npm start
After some time, the application will load in the browser's terminal.
- In the topmost directory of
Core-v4, run
npm run create-user
Follow the prompts and if the website is running from the steps above, you should be able to login with this created account.
Pre-requisite: you will need a Google Cloud Platform project setup to complete this section.
-
Before anything, you must have a GCP(Google Cloud Project) setup.
- Create a Google Cloud Account
- Start a new project
- Follow the prompts, make sure to select
Externalin the Audience section to allow for testing - We can now create Clients in our app, navigate to
Clientsin the left side nav bar to create one - Add
https://developers.google.com/oauthplaygroundthe Authorized redirect URIs to allow OAuth 2.0 Playground to act as the client app and simulate the authorization flow. - We should now see the client appear under the
Clientssection
-
Select the client we created to obtain
Client IDandClient Secret. -
Create a new
config.jsonfile in the/api/config/directory by simply making a copy of the existingconfig.example.jsonand renaming copy toconfig.json.- Ensure in the USER in
config.jsonis the email you plan on using to send the verification email from.
- Ensure in the USER in
-
Open a terminal window and run:
npm run generate-token
The terminal will prompt for Client ID, then the Client Secret, copy the Client ID and Client Secret obtained earlier from Google Cloud.
- You should now see the third prompt, asking you to visit a link and get an
Authorization code. Before you copy theAuthorization code, ensure you have selected and authorized the APIs needed in Step 1.- In this example we are looking to send a verification email.
- We can use the search function to find mail related APIs
- Select the one you feel appropriate
- Click `Authorize APIs`
-
We can now give the
Authorization Codeto the prompt. -
A
token.jsonfile should be created under/api/config/, you should see your authorization token being used there. In a terminal window use the command: (make sure you have 2 other terminal windows running the frontend and mongoDB, or one window running the full stack withsce run c)
- If the command throws an error, you can simply change the `NODE_ENV` variables inside `docker-config.yml`
NODE_ENV=production npm run server
- Now test it by sending an email to yourself!
- Ensure your
config.json'sgoogleApiKeyssection looks something like this
- Ensure your
- If you see an email in your inbox from yourself, it worked!.
- If you do not, ensure
config.jsonhasUSERset to the email you want to be sending the email from.
- If you do not, ensure
- Note: If you need to repeat this process, delete any existing token.js file.
- Create a v2 captcha key pair like below:
- copy the site key into the src/config/config.json
```json
{
"sitekey": "SITEKEY_VALUE_HERE"
}
```
- copy the secret key into the api/config/config.json, specifically `CAPTCHA_SECRET_KEY` value in the `googleApiKeys` object.
Post any relevant screenshots in #development in the SCE Slack and we'll sort it out.
