# Complete AI Business auth.md

How an AI agent gets access to a customer's own data at Complete AI Business (https://completeaibusiness.com), and what that access allows. The resource server and the authorization server are both https://completeaibusiness.com.

## Who this is for

Agents acting for one person: someone who asked for a free AI plan for their business. A token belongs to that person's email address and reaches only the plans made for it. There are no accounts or passwords, and nothing here costs money.

## What needs no credential

- The offer, prices, the 7 days and the FAQ: MCP get_offer, GET https://completeaibusiness.com/api/v1/offer, A2A skill offer
- The 9 case studies (fictive examples): MCP list_case_studies and get_case_study, GET https://completeaibusiness.com/api/v1/case-studies
- Making a free AI plan for the person you act for: MCP create_free_plan, POST https://completeaibusiness.com/api/v1/plans, A2A skill free-plan. The plan is emailed to the address given. Limits: 3 per address per hour through the agent channels (5 per hour in all), 3 per email address a day, and daily ceilings.
- Checking one plan by its id: MCP get_plan_status, GET https://completeaibusiness.com/api/v1/plans/{id}. The 12-character id from the report link is the key, so treat it as private.
- All pages as Markdown (Accept: text/markdown), https://completeaibusiness.com/llms.txt and the discovery documents

## What needs a token

| What | Where | Scope |
|---|---|---|
| List the customer's own plans | MCP my_plans, GET https://completeaibusiness.com/api/v1/me/plans, A2A skill my-plans | plans:read |
| Read one of them | MCP get_my_plan, GET https://completeaibusiness.com/api/v1/me/plans/{id} | plans:read |
| Ask us to start the initial call ($770) or the 7 days ($7,700) | MCP request_start, POST https://completeaibusiness.com/api/v1/me/plans/{id}/start | plans:start |
| Who the token belongs to | GET https://completeaibusiness.com/api/v1/me | any |

Asking to start records a request and emails the customer and our team, who then send a payment link by hand. Nothing is charged through any of this.

## 1. Discover

- Protected resource metadata (RFC 9728): https://completeaibusiness.com/.well-known/oauth-protected-resource, and for the MCP endpoint https://completeaibusiness.com/.well-known/oauth-protected-resource/mcp
- Authorization server metadata (RFC 8414): https://completeaibusiness.com/.well-known/oauth-authorization-server (with an agent_auth block)

## 2. Register a client (anonymous, RFC 7591)

```http
POST https://completeaibusiness.com/oauth/register
Content-Type: application/json

{"client_name": "Your agent", "redirect_uris": ["https://your.app/callback"], "token_endpoint_auth_method": "none"}
```

The reply has your client_id (and a client_secret if you asked for client_secret_post or client_secret_basic). Redirect URIs can be https, http on a loopback address (127.0.0.1, localhost, [::1], any port), or a native app's private-use scheme. 20 registrations per address per hour.

## 3. The person signs in and approves (the claim)

Open this for the person, in their browser:

```
https://completeaibusiness.com/oauth/authorize?response_type=code&client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&scope=plans:read&state=STATE&code_challenge=CHALLENGE&code_challenge_method=S256
```

- PKCE with S256 is required. Add plans:start to the scope only if the person may ask us to start. Optional: resource=https://completeaibusiness.com/mcp (RFC 8707); such a token then works only there.
- The person types the email address they used for their plan. We email them a 6-digit code (10 minutes, 5 tries). Then they see what your app asks for and choose Allow or Don't allow.
- Never ask the person for the code. They type it on our page, not in your app.
- Codes are limited to 10 per address and 5 per email an hour.

You get the person back at your redirect_uri with code, state and iss=https://completeaibusiness.com.

## 4. Exchange the code

```http
POST https://completeaibusiness.com/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=CODE&redirect_uri=REDIRECT_URI&client_id=CLIENT_ID&code_verifier=VERIFIER
```

The reply: access_token (1 hour), refresh_token (30 days) and scope. Refresh with grant_type=refresh_token. Each refresh token works once and is replaced; using an old one revokes every token from that sign-in. Codes work once, for 10 minutes. We store only hashes of codes and tokens.

## 5. Use the token

Send Authorization: Bearer ACCESS_TOKEN to https://completeaibusiness.com/mcp, https://completeaibusiness.com/a2a or https://completeaibusiness.com/api/v1/me/... Without a valid token you get 401 with WWW-Authenticate: Bearer resource_metadata="...". A token without the needed scope gets 403 with error="insufficient_scope". A token that is sent must be valid, even for public tools.

## 6. Revoke

```http
POST https://completeaibusiness.com/oauth/revoke
Content-Type: application/x-www-form-urlencoded

token=TOKEN&client_id=CLIENT_ID
```

Revoking a refresh token ends the whole sign-in. The person can also email contact@completeaitraining.com to end an app's access.

## What no token can reach

Other people's plans, any list of plans, email addresses or phone numbers of others, our team's inboxes, the phone agent's endpoints and memory, how plans are written, and anything we make for a paying customer.
