Skip to main content

Implementation Guide

This guide covers how to integrate the SmarterServices IAM system into your applications, including client libraries, server-side implementation, and best practices.

Architecture Overview

The SmarterServices IAM system consists of:
  1. IAM Service: Central authentication and authorization service
  2. Client Libraries: Language-specific libraries for integration
  3. Policy Engine: Evaluates permissions based on policies
  4. Resource Providers: Services that enforce IAM decisions

Client Libraries

JavaScript/TypeScript (Browser)

Installation

Basic Usage

React Integration

Node.js (Server)

Installation

Basic Usage

Python

Installation

Basic Usage

Java

Maven Dependency

Basic Usage

Temporary Security Tokens (STS)

The Security Token Service mints short-lived, narrowly-scoped, revocable credentials from a longer-lived one — the AWS STS analogue. Use it whenever a credential has to be handed to a less-trusted context (a browser embed, an on-behalf-of call) so the original broad credential never leaves your backend. A token is constrained by three boundaries at issue time:
  • Permission ceiling — the requested policy must be a subset of the calling credential’s effective policy (validatePolicySubset); a token can never exceed its creator.
  • TTL clamp — short by default and capped per token type, further clamped by the deployment’s maxTokenTtlSeconds.
  • Absolute session lifetime — silent refresh is bounded by a hard cap measured from the root token, so a token chain can’t be renewed indefinitely.
The runtime credential is opaque and server-validated (validity is checked server-side, not merely by verifying a signature), so it can be revoked instantly. For embeds, issuance also returns an RS256/JWKS-signed assertion (elementToken) that binds identity + resource and is verified server-side before the embed is trusted.

Issue a token

tokenType selects the issuance template — element (SmarterElements embeds) is the first supported type, and new types are added as additional templates without new endpoints. Requires the sp:CreateStsToken action. Refresh a token via POST /v1/installs/{installSid}/sts/tokens/{tokenSid}/refresh (sp:RefreshStsToken), which mints a replacement, revokes the previous credential, and reuses the original scoped policy. For the SmarterElements browser flow (passing the token to the SDK and silent refresh), see SmarterElements → Authentication & Tokens.

Server-Side Implementation

Express.js Middleware

FastAPI (Python)

Spring Boot (Java)

Frontend Integration

React Hook

Vue.js Directive

Configuration

Environment Variables

Configuration File

Caching

Client-Side Caching

Server-Side Caching

Provide any key-value cache that implements get(key) and set(key, value, ttl); the store is entirely your choice.

Error Handling

Client-Side Error Handling

Server-Side Error Handling

Testing

Unit Testing

Integration Testing

Best Practices

1. Use Least Privilege

Only request the minimum permissions needed for functionality.

2. Cache Appropriately

Cache permission results to improve performance, but ensure cache invalidation works correctly.

3. Handle Errors Gracefully

Always handle IAM service failures gracefully with appropriate fallbacks.

4. Validate Resources

Ensure resource strings are properly formatted and validated.

5. Monitor Performance

Monitor IAM service response times and implement circuit breakers if needed.

6. Secure Service Keys

Store service keys securely and rotate them regularly.

7. Log Security Events

Log all authorization decisions for audit and debugging purposes.

Troubleshooting

Common Issues

  1. Invalid Resource Format: Ensure SSRN format is correct
  2. Token Expiration: Handle token refresh properly
  3. Network Timeouts: Implement proper timeout and retry logic
  4. Cache Inconsistency: Ensure cache invalidation works correctly
  5. Permission Lag: Account for eventual consistency in permission updates

Debugging

  1. Enable Debug Logging: Set log level to debug for detailed information
  2. Check Network Connectivity: Verify IAM service is reachable
  3. Validate Tokens: Ensure authentication tokens are valid
  4. Test Policies: Use IAM policy simulator for testing
  5. Monitor Metrics: Track authorization success/failure rates