Skip to content

Commit 4cb7665

Browse files
committedNov 27, 2022
fix(readme): add oauth in readme
1 parent 9842d8a commit 4cb7665

File tree

2 files changed

+32
-15
lines changed

2 files changed

+32
-15
lines changed
 

‎.github/assets/oauth_schema.png

1.93 MB
Loading

‎README.md

+32-15
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
⚠️ The contracts are currently deployed on the testnet, it is important to use it and not to use the mainnet.
88
### 🐳 With Docker (recommanded)
99
1. Add your [Starton API Key](https://app.starton.io/en/projects) `API_KEY` in the [.env](.env) file of the project
10-
2. Make sure Docker is working with `docker run hello-world`
11-
3. Build and start the app with `docker compose up`
10+
2. Setup MongoDB vars `MONGODB_URI` and `DB_NAME` in the [.env](.env) file of the project
11+
3. Make sure Docker is working with `docker run hello-world`
12+
4. Build and start the app with `docker compose up`
1213
### 🫳🏼 By hand
1314
It is recommanded to use [NVM](https://github.com/nvm-sh/nvm) to have the correct node version.
1415
1. Export your Starton API Key with `export API_KEY=xx_xxx_xxxxxxx-xxxx-xxxx-xxxxxxxxxx`, replacing *xxxxx* with your key
15-
2. Install the correct version of node with `nvm install 18`
16-
3. Use the correct version of node with `nvm use`
17-
4. Install dependencies with `npm install`
18-
5. Build the app with `npm run build`
19-
6. Start the app with `npm start`
16+
2. Export your MongoDB vars with `export MONGODB_URI=xxx && export DB_NAME=xxx`, replacing *xxx* with your vars
17+
3. Install the correct version of node with `nvm install 18`
18+
4. Use the correct version of node with `nvm use`
19+
5. Install dependencies with `npm install`
20+
6. Build the app with `npm run build`
21+
7. Start the app with `npm start`
2022

2123
You can now access to the app at [http://localhost:3000](http://localhost:3000) or [http://localhost:80](http://localhost:80)
2224
#### See the deployed project on [licenka.space](https://licenka.space) !
@@ -39,17 +41,22 @@ The objective of our platform is to make it easy to create a license by defining
3941

4042
One of the challenges is to allow companies to use our solution very easily, so we were inspired by Starton in order to offer public API routes allowing companies to very simply buy, and check if a user has a license without Web3 knowledge.
4143

42-
The technologies we used are [Next.js](https://nextjs.org/) for the front and the API, [Vercel](https://vercel.com/) for the deploy, [Docker](https://vercel.com/), [Web3.js](https://github.com/web3/web3.js), **Starton API**, **BNB Chain** and we support **Ledger**.
44+
The technologies we used are [Next.js](https://nextjs.org/) for the front and the API, [Vercel](https://vercel.com/) for the deploy, [Docker](https://www.docker.com/), [MongoDB](https://www.mongodb.com/), [Web3.js](https://github.com/web3/web3.js), **Starton API**, **BNB Chain** and we support **Ledger**.
4345

4446
Our main technical challenge was to be able to buy licenses easily, because it is necessary to approve the transfer of funds beforehand to be able to make the payment, and companies should not need to use Web3 technologies. Thus, we decided to create a page inspired by Paypal, on which the payment is made and which redirects the user to the chosen address once the license has been acquired.
4547
<p align="center">
4648
<img src="./.github/assets/figma.png" width="75%" alt="Figma model" />
4749
<br>Created figma model
4850
</p>
4951

50-
Another problem we had to deal with was the fact that we could easily authenticate a user with metamask to verify that he had a license. However, it should be possible on top of that to be able to call the Web2 API without having to authenticate, and without verification everyone could enter the wallet of someone who owns the license. For this, users can set a password to use the Web2 version.
52+
Another problem we had to deal with was the fact that we could easily authenticate a user with metamask, on a Web2 app, to verify that he had a license. However we have developed a "oauth" flow (describe below). After oauth flow the client will receive a signed_nonce, which is use to call our Web2 API to authenticate the user and permit to client to know if the user has the license. This process avoids to the Web2 version for companies that do not wish to use Metamask auth.
5153

52-
Thus, our solution can work both with the simplicity of authentication in Web3, and both with the Web2 version for companies that do not wish to use Metamask auth.
54+
<p align="center">
55+
<img src="./.github/assets/oauth_schema.png" width="75%" alt="Figma model" />
56+
<br>Oauth flow
57+
</p>
58+
59+
Thus, our solution can work both with the implementation of their own authentication flow for Web3 client, and both with the Web2 version for companies that do not wish to use Metamask auth.
5360

5461
## 📄 Facility
5562
#### See the deployed project on [licenka.space](https://licenka.space) !2
@@ -58,7 +65,8 @@ Here are the steps to install and test our project :
5865
1. Use `git clone git@github.com:MaximePremont/Licenka.git`
5966
2. Use `cd Licenka`
6067
3. Add your [Starton API Key](https://app.starton.io/en/projects) `API_KEY` in the [.env](.env) file of the project
61-
4. Setup and start like described [here](#how-to-setup-your-project), recommanded : `docker compose up`
68+
4. Setup MongoDB vars `MONGODB_URI` and `DB_NAME` in the [.env](.env) file of the project
69+
5. Setup and start like described [here](#how-to-setup-your-project), recommanded : `docker compose up`
6270

6371
You can now access to the app at [http://localhost:3000](http://localhost:3000)
6472
## 👋 Team and comments
@@ -85,7 +93,8 @@ To use our system, you must first create a license in order to obtain the licens
8593
Our solution is deployed and working with 3 parts :
8694
1. A main page ([https://licenka.space](https://licenka.space)) to show the project
8795
2. A license creation page ([https://licenka.space/create](https://licenka.space/create)), to create a new license with our wallet
88-
3. A license buy page ([https://licenka.space/approve](https://licenka.space/approuve)), which allow the user to buy a license with his wallet, and redirect to the company page after that.
96+
3. A license buy page ([https://licenka.space/approve](https://licenka.space/approve)), which allow the user to buy a license with his wallet, and redirect to the company page after that.
97+
4. A oauth page ([https://licenka.space/oauth?redirect_uri=https://demo.licenka.space/auth&licence_id=7](https://licenka.space/oauth?redirect_uri=https://demo.licenka.space/auth&licence_id=7))
8998

9099
⚠️ To work with the purchase page, the company must indicate the license to be purchased and the page to redirects to something like this : *https://licenka.space/approve/?license=XX&redirect=https://xxxxxx.xx*
91100

@@ -107,9 +116,15 @@ As explained, our API can be used in 2 different ways: Web2 or Web3 :
107116
Query:
108117
userAddress
109118
licenseId
110-
userPassword
119+
signedNonce
111120
200:
112121
license: bool
122+
- Get a nonce of user, with this nonce signed we can authenticate user `https://www.licenka.space/api/wallet/nonce`
123+
```
124+
Query:
125+
walletAddress
126+
200:
127+
nonce: string
113128
- **`Web3 Licenka`**: &nbsp;Here are the functions which can be called by users (Owner functions and internal functions are not displayed)
114129
- **Licenka Contract address:** 0x150B6328F1810589aF899f6d9F17E0347f77c8b8
115130
- **BUSD Contract address** : 0xeD24FC36d5Ee211Ea25A80239Fb8C4Cfd80f12Ee
@@ -180,7 +195,7 @@ As explained, our API can be used in 2 different ways: Web2 or Web3 :
180195
## ☀️ Business model & Growth
181196
The objective of our project is to propose a reliable and very inexpensive alternative. Thus, we will earn money by taking **3 %** when purchasing a license with our system.
182197
183-
Our possible project has a very big potential to grow, indeed we have already been able to imagine an even more advanced system which would make it possible to propose an **OAuth** in order to validate that the licenses are possessed by the users for example.
198+
Our possible project has a very big potential to grow, indeed we have already been able to imagine an even more advanced system which would make it possible to propose an client and/or an user dashboard to they can manage their purchased or selled licenses.
184199
#### 🚀 After some improvements, our project will be ready to be deployed on the mainnet !
185200
186201
## 📤 Project Submission
@@ -198,7 +213,9 @@ Our possible project has a very big potential to grow, indeed we have already be
198213
- Create a license with expiration time
199214
- Check if user has a license
200215
- Get license informations for a user
201-
- Buy a license and define a password
216+
- Buy a license
217+
- Oauth flow with wallet signature of an nonce
218+
- Be able to authenticate user with signed nonce
202219
203220
### Partners :
204221
- Starton : for contract calls and management

0 commit comments

Comments
 (0)
Please sign in to comment.