Open pkarw opened 1 month ago
process.env.NEXT_PUBLIC_SAAS_MODE
?userToken=
(generated by the SaaS management app, valid for 1-2 days just for registration) to be passed which contains the following user data OR application is requestin user's email which is then send to the server:{ "userIdHash": "user unique identifier", "email": "email given during registration"}
the data is stored in the dbContext.userToken
userIdHash
or email
is being sent on the db/create
form to get the available quota to https://saas.doctordock.com/api/quota
(URL is set via process.env.SAAS_MGMT_URLthe quota is returned for specific
userIdHash`:{ "userIdHash": "unique user hash", "instancesAllowed": "1", "instancesUsed": "0", "tokensAllowed": "124000" }
then the request to api/quota
is again sent during the db creation process to validate the quota server side.
db/create
requests is sending the PUT https://saas.doctordock.com/api/sites
request assiging the current - newly created databaseIdHash
with the userIdHash
- with the user account.We might want to store the user data in the database manifest file (JSON) - at least userIdHash
Important: The subsequent requests are using databaseHashId
instead of userIdHash
The db/authorize
after successfull authorization is always sending the api/quota
request and returns it in the additional data record along with accessKey
Application stores the quota in the dbContext.quota
and uses it for ongoing request validation / approvals
Would be great to react on ENV variable specifying the SaaS provisioning API having three main features: