Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

1.7 KB
Raw Blame
// OAuth configuration
export const OAUTH_CONFIG = {
  ACCESS_TOKEN_LIFETIME: 2 * 60 * 60, // 2 hours
  REFRESH_TOKEN_LIFETIME: 120 * 24 * 60 * 60, // 120 days
  CODE_LIFETIME: 2 * 60, // 2 minutes

  CLIENT_ID_LENGTH: 24,
  CLIENT_SECRET_LENGTH: 30,
  ACCESS_TOKEN_LENGTH: 40,
  REFRESH_TOKEN_LENGTH: 40,
  CODE_LENGTH: 40,

  CLIENT_ID_PREFIX: "dub_app_",
  CLIENT_SECRET_PREFIX: "dub_app_secret_",
  ACCESS_TOKEN_PREFIX: "dub_access_token_",
};

// These are the scopes an OAuth app can request on behalf of an user
// Keep it separate from the actual scopes to avoid confusion
// We don't want all the scopes to be requested by an app
export const OAUTH_SCOPES = [
  "links.read",
  "links.write",
  "tags.read",
  "tags.write",
  "analytics.read",
  "domains.read",
  "domains.write",
  "webhooks.read",
  "webhooks.write",
  "folders.read",
  "folders.write",
  "customers.read",
  "customers.write",
  "user.read", // default scope, no need to request it
];

// Scope descriptions
export const OAUTH_SCOPE_DESCRIPTIONS = {
  "links.read": "Read access to links",
  "links.write": "Read and Write access to links",
  "tags.read": "Read access to tags",
  "tags.write": "Read and Write access to tags",
  "analytics.read": "Read access to analytics and events",
  "domains.read": "Read access to domains",
  "domains.write": "Read and Write access to domains",
  "user.read": "Read your name, email and profile image",
  "webhooks.read": "Read access to webhooks",
  "webhooks.write": "Read and Write access to webhooks",
  "folders.read": "Read access to folders",
  "folders.write": "Read and Write access to folders",
  "customers.read": "Read access to customers",
  "customers.write": "Read and Write access to customers",
};