Alternate Futures
Retired af CLI guides

Applications

Legacy guide - retired af CLI

This page was written for the retired af CLI and the sites/storage workflow. The current CLI is acc (compute services), which does not include these commands yet. Commands on this page will not work with acc. Kept for reference while this functionality is rebuilt.

Applications in Alternate Futures allow you to create OAuth applications and manage whitelisted domains for CORS and authentication purposes.

What are Applications?

Applications are OAuth 2.0 applications that can authenticate users and access the Alternate Futures API on their behalf. Each application has:

  • Client ID - Public identifier for your application
  • Name - Human-readable application name
  • Whitelist Domains - Allowed domains for CORS and OAuth redirects

Creating an Application

# Create a new application
af applications create

# You'll be prompted for:
# - Application name
# - Whitelist domains (comma-separated)

Listing Applications

# List all applications
af applications list

Updating an Application

# Update an application
af applications update

# You'll be prompted to:
# 1. Select the application
# 2. Update name and/or whitelist domains

Deleting an Application

# Delete an application
af applications delete

# You'll be prompted to select which application to delete

Use Cases

Web Application Authentication

Use applications to authenticate users in your web application:

  1. Create an application with your production and staging domains whitelisted
  2. Use the Client ID in your OAuth flow
  3. Users can sign in with their Alternate Futures account
  4. Your application receives an access token to make API calls

CORS Configuration

Whitelist domains are automatically allowed for CORS requests:

// This request will succeed if the origin is whitelisted
fetch('https://api.alternatefutures.ai/v1/sites', {
  headers: {
    'Authorization': `Bearer ${accessToken}`
  }
});

Multi-Environment Setup

Create separate applications for different environments:

# Development app
af applications create
# Name: My App (Dev)
# Domains: http://localhost:3000

# Production app
af applications create
# Name: My App (Prod)
# Domains: https://myapp.com, https://www.myapp.com

Security Best Practices

Security

  • Only whitelist domains you control
  • Use HTTPS for all production domains
  • Create separate applications for different environments
  • Regularly audit your whitelist domains
  • Delete unused applications

Next Steps

On this page