> **Building with AI coding agents?** Install the authstack plugin with one command. This equips your agent with accurate Scalekit implementation patterns.
>
> **Recommended**:
> ```bash
> npx @scalekit-inc/cli setup
> ```
>
> Global:
> ```bash
> npm install -g @scalekit-inc/cli
> scalekit setup
> ```
>
> Supports Claude Code, Cursor, GitHub Copilot, Codex + skills for 40+ agents.
> Features: full-stack-auth, agent-auth, mcp-auth, modular-sso, modular-scim.
> [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Authorization

Authorization helpers for protected resources
<div class="sdk-client-page">

Use auth helpers for authorization code exchange, token validation, and related login token flows on the Scalekit client.

These methods sit next to session management—use them when implementing hosted login callbacks and token checks.

### getAuthorizationUrl
<div class="sdk-method-section">
  
    
      

      Runs `getAuthorizationUrl` and returns the result.

      
        Redirect uri.
      
      
        Optional request settings.
      
      
        The response payload for this operation.
      

```java wrap showLineNumbers=false

AuthorizationUrlOptions options = new AuthorizationUrlOptions();
options.setOrganizationId("org_123");
options.setState("random-state-value");

URL authUrl = scalekitClient.authentication().getAuthorizationUrl(
  "https://yourapp.com/auth/callback",
  options
);
```

    
  
</div>

### validateAccessToken
<div class="sdk-method-section">
  
    
      

      Runs `validateAccessToken` and returns the result.

      
        Jwt.
      
      
        boolean
      

```java wrap showLineNumbers=false
boolean ok = scalekitClient.authentication().validateAccessToken("<access_token_jwt>");
```

    
  
</div>

### generateClientToken
<div class="sdk-method-section">
  
    
      

      Runs `generateClientToken` and returns the result.

      
        Client ID.
      
      
        Client secret.
      
      
        String.
      

    
  
</div>

### getClientAccessToken
<div class="sdk-method-section">
  
    
      

      Runs `getClientAccessToken` and returns the result.

      
        The response payload for this operation.
      

```java wrap showLineNumbers=false
String token = scalekitClient.authentication().getClientAccessToken();
```

    
  
</div>

### authenticateWithCode
<div class="sdk-method-section">
  
    
      

      Runs `authenticateWithCode` and returns the result.

      
        Authorization code.
      
      
        Redirect uri.
      
      
        Optional request settings.
      
      
        Authentication.
      

```java wrap showLineNumbers=false

AuthenticationResponse result = scalekitClient.authentication().authenticateWithCode(
  "<code>",
  "https://yourapp.com/auth/callback",
  new AuthenticationOptions()
);

String accessToken = result.getAccessToken();
```

    
  
</div>

### updateLoginUserDetails
<div class="sdk-method-section">
  
    

      Updates the user details for an in-progress login request, for example after collecting additional profile information, or marking the login as failed with `User.newBuilder().setLoginFailed(true)`.

      
        The connection ID the login request belongs to.
      
      
        The login request ID being updated.
      
      
        The user details to apply to the login request.
      
      
        Result carrying the auth request ID (`result.getAuthRequestId()`), which you can use to look up the user's authentication journey in the auth logs.
      

```java wrap showLineNumbers=false

User user = User.newBuilder()
  .setSub("unique_user_id_456")
  .setEmail("john.doe@company.com")
  .build();

UpdateLoginUserDetailsResult result = scalekitClient.login().updateLoginUserDetails(
  "conn_abc123",
  "login_xyz789",
  user
);

// The auth request ID can be used to look up the authentication journey via auth logs.
String authRequestId = result.getAuthRequestId();
```

    
  
</div>

</div>


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
