⚙️ Oto, the man in the middle - OAuth2 middleware lambda
By design, you cannot use OAuth2 without a server, since you need to store a secret key from the provider.
In a world full of PWA and static websites, it´s a bummer.
oto is a small middleware, a lambda serverless function, which only role is to serve as the server in a OAuth2 transaction.
Read the dev.to article introducing oto & its purpose.
Firstly, run the classic npm install
to install dependencies.
You will also need to create the file env/sls.env.json
, following this structure:
{
"dev": {
"PROVIDER_ACCESSID": "ACCESSKEY",
"PROVIDER_ACCESSID": "ACCESSKEY"
}
}
It can contains as many values as you want (like for different stages of development).
The PROVIDER
value is the service to connect, like github
; ACCESSID
is the public access id given by the service ; ACCESSKEY
is the private access key given by the service.
Example:
{
"dev": {
"github_xxxxxx": "xyzxyzxyzxyz"
}
}
-
github
-
linkedin
-
google
Run npm run build
to build the code, or npm run work
to watch the changes and rebuild.
Run npm run dev
to create a local host serving the lambda, on port 6060
.
You need to have setup the appropriate user from AWS and stored it in your ~/.aws/credentials
.
npm run deploy:dev --aws-profile=<your-aws-profile>
npm run deploy:prod --aws-profile=<your-aws-profile>
🤟 You are working on a project for BeCode and want to use oto?
Contact My Becode Teammy@becode.org
via email to inject your app's credentials and use our instances!
My Becode Team