Credentials နဲ့ Security
Credentials ဆိုတာ ဘာလဲ?
Section titled “Credentials ဆိုတာ ဘာလဲ?”n8n ကနေ Gmail, Slack, Google Sheets စတဲ့ App တွေနဲ့ ချိတ်ဆက်ဖို့ Authentication လိုအပ်ပါတယ်။ Credentials ဆိုတာ အဲ့ဒီ API Keys, Passwords, OAuth Tokens တွေကို Encrypted ပုံစံနဲ့ n8n မှာ လုံခြုံအောင် သိမ်းဆည်းပေးတဲ့ စနစ်ပါ။
Credentials မရှိဘဲနဲ့ n8n က External App တွေကို လှမ်းသုံးလို့ မရပါဘူး။ Credentials ချိတ်ဆက်ပြီးမှသာ Data ကို လုံခြုံစွာ ဖလှယ်နိုင်မှာပါ။
Credential အမျိုးအစားများ
Section titled “Credential အမျိုးအစားများ”1. API Key
Section titled “1. API Key”App ကနေ ထုတ်ပေးတဲ့ Unique Token လေးကို သုံးပြီး Authenticate လုပ်တာပါ -
API Key Example:sk-proj-AbCdEfGhIjKlMnOpQrStUv1234567890
n8n HTTP Request Node မှာ: Header: Authorization: Bearer {{ credential.apiKey }}API Key ကိုသုံးတဲ့ App များ: OpenAI, Anthropic, Airtable, Mailchimp
2. OAuth 2.0
Section titled “2. OAuth 2.0”User ကို External Service ရဲ့ Login Page ဆီ လမ်းကြောင်းလွှဲပေးပြီး၊ User ကိုယ်တိုင် Permission လာပေးရတဲ့ စနစ်ပါ -
OAuth 2.0 Flow — User ရဲ့ Permission ဖြင့် Token ရယူခြင်း
OAuth ကိုသုံးတဲ့ App များ: Gmail, Google Sheets, Slack, GitHub, Notion
3. Basic Auth / Username & Password
Section titled “3. Basic Auth / Username & Password”Basic Auth: Username: user@example.com Password: mypassword123ဥပမာ: MySQL Database, Custom APIs
Credential ဖန်တီးနည်း
Section titled “Credential ဖန်တီးနည်း”Step 1: Credentials Menu ကို သွားပါ
Section titled “Step 1: Credentials Menu ကို သွားပါ”Left Sidebar ကနေ Credentials → + Add Credential ကို သွားပါ။
App တစ်ခုကို Search လုပ်ပြီး (ဥပမာ “Gmail”)၊ Credential Type ကို ရွေးပါ — Gmail (OAuth2) ဒါမှမဟုတ် Gmail (IMAP)။
Step 2: Authentication Type ရွေးပါ
Section titled “Step 2: Authentication Type ရွေးပါ”ဥပမာ — Gmail Credential ဖန်တီးရာမှာ နာမည်ပေးပြီး၊ Client ID နဲ့ Client Secret ကို ထည့်ပါ။ အဲ့ဒီနောက် “Connect my account” ကို နှိပ်ရင် OAuth Login Page ကို ပြောင်းသွားပါလိမ့်မယ်။
Step 3: Credential ကို Node မှာ ယူသုံးပါ
Section titled “Step 3: Credential ကို Node မှာ ယူသုံးပါ”Gmail Node ကို Configure လုပ်တဲ့အခါ Credential Dropdown ထဲကနေ ခုနက ဖန်တီးထားတဲ့ Credential ကို ပြန်ရွေးပေးလိုက်ရုံပါပဲ -
Gmail Node: Credential: [My Gmail Account ▼] Resource: [Message] Operation: [Send]Security Best Practices
Section titled “Security Best Practices”1. Credential ကို Workflow ထဲ Hard-code မလုပ်ပါနဲ့
Section titled “1. Credential ကို Workflow ထဲ Hard-code မလုပ်ပါနဲ့”❌ မကောင်းသော နည်း (Hard-coded API Key): HTTP Request → Header: Authorization: Bearer sk-proj-AbCdEf...
✅ ကောင်းသော နည်း (n8n Credential): Create credential named "OpenAI API" HTTP Request → Credential: [OpenAI API ▼]2. Environment Variables သုံးပါ
Section titled “2. Environment Variables သုံးပါ”Self-hosting လုပ်ထားတယ်ဆိုရင် Sensitive Config တွေကို .env File ထဲမှာ ထည့်ပါ -
# .env fileN8N_ENCRYPTION_KEY=your-random-32-char-secret-keyDB_TYPE=postgresdbDB_POSTGRESDB_PASSWORD=your-db-passwordWEBHOOK_URL=https://your-domain.com3. Credential Scope ကို Limit လုပ်ပါ
Section titled “3. Credential Scope ကို Limit လုပ်ပါ”Google API ကို ဖန်တီးတဲ့အခါ Workflow က တကယ်လိုအပ်တဲ့ Permission ကိုပဲ တောင်းပါ -
ဥပမာ - Google Sheets Credential: ❌ "Full Google Account Access" မတောင်းပါ ✅ "Google Sheets only" Scope ကိုသာ သုံးပါ4. Credential ကို Share မလုပ်ပါ
Section titled “4. Credential ကို Share မလုပ်ပါ”n8n User Roles -
- Owner — Full access (Credential တွေကိုပါ စီမံနိုင်တယ်)
- Admin — Workflow တွေ စီမံနိုင်တယ် + Credentials ကို သုံးနိုင်တယ်
- Member — Workflow ကိုပဲ သုံးလို့ရတယ် (Credential တွေကို မြင်ခွင့်မရှိဘူး)
Google Services ချိတ်ဆက်ဥပမာ
Section titled “Google Services ချိတ်ဆက်ဥပမာ”Google Sheets Credential ဖန်တီးနည်း (OAuth2) -
Step 1: Google Cloud Console
Section titled “Step 1: Google Cloud Console”- console.cloud.google.com ကို သွားပါ။
- Project အသစ် ဖန်တီးပါ (သို့မဟုတ် ရှိပြီးသား Project ကို ရွေးပါ)။
- APIs & Services → Enable APIs → “Google Sheets API” ကို ဖွင့်ပါ။
- OAuth consent screen ကို Configure လုပ်ပါ။
- Credentials → Create Credentials → OAuth 2.0 Client ID ယူပါ။
Step 2: n8n ထဲ ထည့်ပါ
Section titled “Step 2: n8n ထဲ ထည့်ပါ”Client ID နဲ့ Client Secret ကို n8n Credential Form ထဲ ထည့်ပြီး “Sign in with Google” ကို နှိပ်ပါ။ Google Login Page ကို ရောက်သွားရင် Permission ပေးလိုက်ပါ။
Credential Sharing အကြောင်း
Section titled “Credential Sharing အကြောင်း”n8n Enterprise မှာတော့ Credential ကို Team Members တွေနဲ့ Share နိုင်ပါတယ် -
Sharing a Credential: Credential → Settings → Share with: [Select Users]Share ပေးလိုက်တဲ့ User တွေက Credential ကို Workflow ထဲမှာ ယူသုံးနိုင်ပါတယ်။ ဒါပေမဲ့ API Key ကိုတော့ သူတို့ မျက်စိနဲ့ မြင်ရမှာ မဟုတ်ပါဘူး — Security အရ တော်တော်လေး စိတ်ချရပါတယ် ခင်ဗျာ။
နောက်သင်ခန်းစာမှာ ပထမဆုံး Workflow ကို အတူတူ ဆောက်ကြပါမယ်!