Skip to content
/ oto Public

⚙️ Oto, the man in the middle - OAuth2 middleware lambda

Notifications You must be signed in to change notification settings

becodeorg/oto

Repository files navigation

BeCode: oto

⚙️ Oto, the man in the middle - OAuth2 middleware lambda


About

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.

Installation

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"
  }
}

Supported providers

  • github
  • linkedin
  • google

Usage

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.

Deployment

You need to have setup the appropriate user from AWS and stored it in your ~/.aws/credentials.

Dev deployment

npm run deploy:dev --aws-profile=<your-aws-profile>

Production deployment

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 Team my@becode.org via email to inject your app's credentials and use our instances!


My Becode Team