# auth.md

You are an agent. This service supports **agentic registration**: discover → register → (claim if needed) → exchange for an access_token → call API → handle revocation. Follow the steps in order; do not skip ahead.

## Step 1 — Discover

### 1a. Fetch the Protected Resource Metadata

```http
GET /.well-known/oauth-protected-resource
Host: www.ima-appweb.com
```

Response:

```json
{
  "resource": "https://www.ima-appweb.com",
  "authorization_servers": ["https://www.ima-appweb.com"],
  "scopes_supported": ["read", "write", "ai_consultation"],
  "bearer_methods_supported": ["header"]
}
```

### 1b. Fetch the Authorization Server metadata

```http
GET /.well-known/oauth-authorization-server
Host: www.ima-appweb.com
```

The `agent_auth` block in the response tells you how to register.

## Step 2 — Pick a method

1. **You have a session tied to a user identity and can exchange it for an ID-JAG** → use `identity_assertion`.
2. **You have neither** → use `anonymous`. Claim ceremony optional.

## Step 3 — Register

### identity_assertion + id-jag

```http
POST /enquiry/ HTTP/1.1
Host: www.ima-appweb.com
Content-Type: application/json

{
  "type": "identity_assertion",
  "assertion_type": "urn:ietf:params:oauth:token-type:id-jag",
  "assertion": "<your-id-jag-token>",
  "scope": "read write ai_consultation"
}
```

### anonymous

```http
POST /enquiry/ HTTP/1.1
Host: www.ima-appweb.com
Content-Type: application/json

{
  "type": "anonymous",
  "client_name": "My AI Agent",
  "scope": "read ai_consultation"
}
```

## Step 4 — Claim (anonymous only)

If you registered as `anonymous`, the response includes a `claim_url`. Present this URL to the user so they can verify ownership.

## Step 5 — Exchange for access_token

```http
POST /next-api/voice-token HTTP/1.1
Host: www.ima-appweb.com
Content-Type: application/x-www-form-urlencoded

grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=<identity_assertion>
```

## Step 6 — Call the API

```http
GET /openapi.json HTTP/1.1
Host: www.ima-appweb.com
Authorization: Bearer <access_token>
```

## Product Links

- Enterprise Solutions: https://www.ima-appweb.com/solutions/asima-ai/
- Cost Calculator: https://www.ima-appweb.com/calculate-website-development-cost/
- API Documentation: https://www.ima-appweb.com/openapi.json

## Legal

- Terms & Conditions: https://www.ima-appweb.com/ima-appweb-terms-and-conditions/
- Privacy Policy: https://www.ima-appweb.com/ima-appweb-privacy-policy/
- Cookie Policy: https://www.ima-appweb.com/cookies-policy-of-ima-appweb/

## Contact

- **Support Email**: info@ima-appweb.com
- **Phone Desk**: +91-9871-192-979
