# Quickstart

Authito is the easiest way to add authentication to your web applications.

## Steps

1. Sign in to [Authito](https://app.authito.com/login) and create an app.
2. Copy the auth token of the app.
3. Put the token in the environment variable `AUTHITO_AUTH_TOKEN`.
4. Add the middleware, as shown for your framework below.

## Middleware

### Node (Express)

```sh
npm install @authito/express
```

```js
// main.js
import express from 'express'
import { authito } from '@authito/express'

const app = express()

app.use(authito())

app.get('/', (req, res) => {
  res.send(`Hello, ${req.user.name}`)
})

app.listen(3000)
```

```sh
export AUTHITO_AUTH_TOKEN=<your token>
node main.js
```

### Python (Flask)

```sh
pip install authito
```

```python
# main.py
from flask import Flask, g
from authito.flask import Authito

app = Flask(__name__)
Authito(app)

@app.get("/")
def home():
    return f"Hello, {g.user.name}"
```

```sh
export AUTHITO_AUTH_TOKEN=<your token>
flask --app main run
```

### Go

```sh
go get github.com/secretsdepot/authito-go
```

```go
// main.go
package main

import (
	"fmt"
	"net/http"

	"github.com/secretsdepot/authito-go"
)

func main() {
	mux := http.NewServeMux()
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		user := authito.UserFrom(r.Context())
		fmt.Fprintf(w, "Hello, %s", user.Name)
	})

	http.ListenAndServe(":3000", authito.Middleware(mux))
}
```

```sh
export AUTHITO_AUTH_TOKEN=<your token>
go run main.go
```

