> For the complete documentation index, see [llms.txt](https://sonic-ai-works.gitbook.io/sonic-networks-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sonic-ai-works.gitbook.io/sonic-networks-docs/documentation/application-and-website/dashboard-and-role-based-applications/auth-saas-and-access-bootstrap.md).

# Auth, SaaS & Access bootstrap

Canonical SONIC dashboard bootstrap using Auth Context, SaaS Context and route/resource-aware Access Context with Developer role support.

SONIC boots authenticated applications from normalized server-authoritative projections; React state, localStorage and wallet state do not define authority.

```
Clerk session
→ GET /api/v1/auth/context
→ SONIC user + workspace membership
→ parallel:
   GET /api/v1/saas/me
   GET /api/v1/access/context?path=<pathname>
→ authenticated application shell
```

## Provider composition

```
SonicAuthProvider
→ SonicIdentityProvider
→ SonicSaaSProvider
→ SonicAccessProvider
→ SonicWalletProvider
→ SonicSecurityProvider
→ Application
```

## Access context

A useful projection includes:

```ts
type AccessContext = {
  userId: string;
  workspaceId: string;
  role: "OWNER" | "ADMIN" | "CREATOR" | "DEVELOPER" | "FINANCE" | "MODERATOR" | "MEMBER" | "VIEWER";
  permissions: string[];
  entitlements: string[];
  aal: 0 | 1 | 2 | 3;
  allowed: boolean;
  reason?: string;
  policyVersion: string;
  authorityRevision: string;
};
```

## Developer access

```
role == DEVELOPER
+ developer.portal.read
+ developer platform entitlement where required
= Developer Portal visible
```

Creating or rotating an API key additionally requires `developer.api_key.manage`; provider connections require their own scope. A Developer role never grants Finance/Admin authority.

## Invalidation

Refresh Auth/SaaS/Access projections after membership, role, permission, entitlement, account/workspace, verified-wallet or session changes. Route changes refresh route-aware access.

Responses use conservative private caching:

```http
Cache-Control: private, no-store, max-age=0
Vary: Cookie, Authorization
```

Every protected mutation repeats authorization and domain-state validation server-side.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sonic-ai-works.gitbook.io/sonic-networks-docs/documentation/application-and-website/dashboard-and-role-based-applications/auth-saas-and-access-bootstrap.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
