- Homepage
- Login with Google
- Login with Azure (Office365)
- Logout
- Node.js
- Docker
- Docker-compose
- Make
All configurations will be done in the backend directory
- Create a
.env
file in the backend directory - Copy content from
.env.dist
to.env
- Fill the
GOOGLE_CLIENT_ID
andGOOGLE_CLIENT_SECRET
with your Google OAuth credentials - Fill the
AZURE_CLIENT_ID
andAZURE_CLIENT_SECRET
andAZURE_TENANT_ID
with your Azure OAuth credentials - Fill the
SESSION_SECRET
with a random string
This is the easiest way to run the application
- Clone the repository
- cd to project directory
- make configuration changes as mentioned above
- Run
docker-compose up --build
- Open
http://localhost:3000
in your browser
- Clone the repository
- cd to project directory
- Make configuration changes as mentioned above
- Run
docker build -t demo-oauth-app .
- Run
docker run -p 3000:3000 demo-oauth-app
- Open
http://localhost:3000
in your browser
- Clone the repository
- Make configuration changes as mentioned above
- Run
make build
- Run
make run
- Open
http://localhost:3000
in your browser
- Clone the repository
cd /home
git clone https://py@gl3.freegigs.net/py/passprt.git
cd passprt
git checkout master
- Make configuration changes as mentioned above
- Go to the frontend directory
cd frontend
- Run
npm install
- Run
npm run build
- Go to the root directory
cd ..
- Go to the backend directory
cd backend
- Run
npm install
- Run
npm start
- Open
http://localhost:3000
in your browser - Add the following to nginx.conf:
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
You need to use /users/register endpoint with a POST request and a JSON body like this:
{
"username": "user@example.com",
"password": "password"
}
Do not add user to database directly, password is hashed before saving to database.
Use sqlite3 cli to connect to the database and add a new user with the following SQL query:
INSERT INTO user (username, hashed_password, salt, email, providerId, provider) VALUES (?, ?, ?, ?,?,?)'
username
is the email of the userhashed_password
is the hashed password of the user, can be null for Google and Azure userssalt
is the salt of the user, can be null for Google and Azure usersemail
is the email of the userproviderId
is the id of the user in the provider (Google or Azure)provider
is the provider name (google or azure)
There is two database in backend folder. database.db for as user database, sessions.db is for session storage. You can delete these files to reset the database.
- Go to Google Developer Console
- Create a new project
- Go to
Credentials
tab - Create a new OAuth 2.0 Client ID
- Fill the form with your domain and redirect URI (https://example.com/auth/google/callback)
- Copy the
Client ID
andClient Secret
to the.env
file
- Go to Azure App Registration
- Create a new app registration
- Go to
Certificates & secrets
tab - Create a new client secret
- Copy the
Client ID
,Client Secret
andTenant ID
to the.env
file
Error: listen EADDRINUSE: address already in use :::3000
- This error occurs when the port 3000 is already in use. You can change the port in the
.env
file by changing thePORT
variable.
- This error occurs when the port 3000 is already in use. You can change the port in the
Error: SQLITE_CANTOPEN: unable to open database file
- This error occurs when the database file is not found. You can create the database file by running the application or by creating an empty file with the name
database.db
in the backend directory.
- This error occurs when the database file is not found. You can create the database file by running the application or by creating an empty file with the name
Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: user.username
- This error occurs when you try to add a user with an existing username. You can change the username or delete the existing user from the database. We are using email addresses as username. You can see that error if you try to connect with the same email address with different providers (Google, Azure, etc.).
TypeError: Invalid value for clientId.The value cannot be empty
- This error occurs when the
GOOGLE_CLIENT_ID
orAZURE_CLIENT_ID
is not set in the.env
file. You need to set theGOOGLE_CLIENT_ID
andGOOGLE_CLIENT_SECRET
orAZURE_CLIENT_ID
,AZURE_CLIENT_SECRET
andAZURE_TENANT_ID
in the.env
file.
- This error occurs when the