clone

a daily shikaku puzzle for phones: one seeded puzzle per date, solved by dragging rectangles

main
rect.run / .github / skills / deno-deploy / references / AUTHENTICATION.md
AUTHENTICATION.md 4.6K rendered
1# Deno Deploy Authentication23## Interactive Authentication (Default)45The first time you run `deno deploy`, it will open a browser for authentication:67```bash8deno deploy9# Opens: https://console.deno.com/auth?code=XXXX-XXXX10```1112**Important - Browser Device Authorization Flow:**13- The CLI opens your browser and waits for you to complete authentication14- You must complete the authorization in your browser before the CLI can continue15- The CLI will not proceed automatically - it waits until you finish16- Credentials are stored in your system keyring after successful auth1718**Note:** When running `deno deploy` commands that require authentication, the user must complete the browser authorization before the deployment can proceed.1920## Non-Interactive Authentication (CI/CD & Automation)2122To deploy without browser interaction (for CI/CD pipelines or automated workflows):2324### 1. Create a Deploy Token25261. Visit https://console.deno.com/account/access-tokens272. Click "New Access Token"283. Give it a descriptive name (e.g., "GitHub Actions CI")294. Copy the token immediately (shown only once)3031### 2. Use the Token3233```bash34# Option 1: Environment variable (recommended for CI/CD)35export DENO_DEPLOY_TOKEN="your-token-here"36deno deploy --prod3738# Option 2: Inline flag (for one-off commands)39deno deploy --token "your-token-here" --prod40```4142### 3. GitHub Actions Example4344```yaml45- name: Deploy to Deno Deploy46 env:47 DENO_DEPLOY_TOKEN: ${{ secrets.DENO_DEPLOY_TOKEN }}48 run: deno deploy --prod49```5051If the app doesn't exist yet, create it first in CI/CD using non-interactive flags:5253```yaml54- name: Create and deploy app55 env:56 DENO_DEPLOY_TOKEN: ${{ secrets.DENO_DEPLOY_TOKEN }}57 run: |58 deno deploy create \59 --org my-org --app my-app \60 --source local \61 --runtime-mode dynamic --entrypoint main.ts \62 --build-timeout 10 --build-memory-limit 2048 --region us63```6465After the app is created, subsequent deploys only need `deno deploy --prod`.6667**Tip:** For fully automated deploys without browser prompts, ensure a Deno Deploy access token is set up. Create one at https://console.deno.com/account/access-tokens, then set it as the `DENO_DEPLOY_TOKEN` environment variable.6869## Finding Your Organization Name7071The Deno Deploy CLI requires an organization context for most operations. To find your org name:72731. Visit https://console.deno.com742. Your org is in the URL: `console.deno.com/YOUR-ORG-NAME`7576**Note:** Commands like `deno deploy orgs` and `deno deploy switch` require an existing org context to work - this is a CLI limitation. Always find your org name from the console URL first.7778## Setting Up Your First App7980**Before creating:** Check if an app already exists:8182```bash83cat deno.json | grep -A5 '"deploy"'84```8586If no deploy config exists, you need to create the app first. Apps must be created before they can be deployed to.8788**Interactive creation** (opens a browser):89```bash90deno deploy create --org your-org-name91```9293This opens a browser to create the app. **Important:**94- Complete the app creation in your browser95- The CLI waits until you finish - it won't proceed automatically96- The app name becomes your URL: `<app-name>.deno.dev`9798**Non-interactive creation** (for AI agents and CI/CD — no browser needed):99```bash100deno deploy create \101 --org your-org-name \102 --app your-app-name \103 --source local \104 --runtime-mode dynamic \105 --entrypoint main.ts \106 --build-timeout 5 \107 --build-memory-limit 1024 \108 --region us109```110111This creates the app and does the initial deploy in one step. No browser interaction required. See the main skill doc for the full list of `create` flags.112113**Verifying Success:** After completion, verify by checking deno.json:114115```bash116cat deno.json | grep -A5 '"deploy"'117```118119You should see:120```json121"deploy": {122 "org": "your-org-name",123 "app": "your-app-name"124}125```126127After this, subsequent deploys only need:128```bash129deno deploy --prod130```131132## Interactive Commands133134Some `deno deploy` commands are interactive and cannot be run through automated tools.135136### Switching Organizations/Apps137138```bash139deno deploy switch140```141142This opens an interactive menu to select org and app.143144**Alternative - Use Explicit Flags:**145146Instead of interactive selection, specify org/app directly:147148```bash149deno deploy --org your-org-name --app your-app-name --prod150```151152This bypasses the interactive flow.153154## Commands That Fail Without Org Context155156These commands will error if no org is configured:157- `deno deploy` (without --org flag)158- `deno deploy orgs`159- `deno deploy switch`160- `deno deploy env list`161- `deno deploy logs`162163Always ensure org context is set via deno.json or --org flag before running these commands.