Skip to content

د Google Drive Channel اضافه کول

مخکې څه ته اړتیا لرئ

له پیل مخکې دا شیان برابر کړئ:

اړتیاولې ورته اړتیا ده
Google accountGoogle Cloud ته د لاسرسي او Google Drive د authorize کولو لپاره
Google Cloud projectد Drive API فعالولو او OAuth credentials جوړولو لپاره
OAuth 2.0 clientImgBed یې د Client ID، Client Secret او Refresh Token اخیستلو لپاره کاروي
ستاسو ImgBed domainد OAuth redirect URI لپاره کارېږي. دا باید له هغه domain سره برابر وي چې تاسې یې رښتیا کاروئ.

د تنظیم پړاوونه

1 ګام: Google Drive API فعال کړئ

  1. Google Cloud Console پرانیزئ.
  2. نوی project جوړ کړئ یا موجود project وټاکئ.
  3. APIs & Services ته لاړ شئ.
  4. Enable APIs and Services کلیک کړئ.
  5. Google Drive API ولټوئ.
  6. پاڼه یې پرانیزئ او enable کلیک کړئ.
  1. په Google Cloud کې Google Auth Platform پرانیزئ.
  2. د Branding بنسټیز معلومات بشپړ کړئ، لکه app name، support email او developer contact email.
  3. Audience پرانیزئ.
  4. د ډېرو self-hosted شخصي نصبونو لپاره External مناسب دی.
  5. که External مو وټاکه، هغه Google account چې authorize کوئ د Test users لاندې اضافه کړئ.
  6. Data Access پرانیزئ.
  7. د Google Drive اړین permissions اضافه کړئ.

3 ګام: OAuth 2.0 Client جوړ کړئ

  1. په Google Auth Platform کې Clients پرانیزئ.
  2. نوی client جوړ کړئ.
  3. د application type په توګه Web application وټاکئ.
  4. داسې نوم ورکړئ چې وروسته یې وپېژنئ.
  5. د authorized JavaScript origins لپاره خپل ImgBed URL ولیکئ، د بېلګې په توګه:
text
https://img.example.com
  1. د authorized redirect URIs لپاره ولیکئ:
text
https://img.example.com/api/oauth/google/callback

Create OAuth client

Enter domain and callback URL

کله چې client جوړ شو، دا ارزښتونه copy کړئ:

Generated ValueImgBed Field
Client IDClient ID
Client SecretClient Secret

4 ګام: د Google Drive Channel ډک کړئ

په Upload Settings کې Google Drive وټاکئ او دا fields ډک کړئ:

ImgBed Fieldڅه ولیکئ
Channel nameداسې نوم چې وپېژندل شي، لکه Main Google Drive
Client IDله Google Cloud څخه اخیستل شوی Client ID
Client Secretله Google Cloud څخه اخیستل شوی Client Secret
Refresh Tokenاوس یې تش پرېږدئ. په بل ګام کې یې اخلئ.
Root directoryاختیاري. Default یې imgbed دی.

Fill client details in ImgBed

5 ګام: Refresh Token واخلئ

  1. Get Token کلیک کړئ.
  2. هغه Google account وټاکئ چې نښلول یې غواړئ.
  3. د authorization پیغامونه بشپړ کړئ.
  4. callback page به Refresh Token ښکاره کړي.
  5. هغه copy کړئ.
  6. بېرته ImgBed ته راشئ او د Refresh Token field کې یې paste کړئ.

Copy Refresh Token after authorization

که وروسته Google account بدل کړئ، OAuth client بدل کړئ، یا پخوانی authorization expire شي، channel ړنګولو ته اړتیا نشته. د edit پاڼه پرانیزئ او Reauthorize کلیک کړئ.

6 ګام: Channel خوندي کړئ

کله چې ټول fields ډک شول، channel save کړئ.

چټک بهیر

text
Open Google Cloud
-> Create or select a project
-> Enable Google Drive API
-> Configure Google Auth Platform
-> If Audience is External, add your Google account to Test users
-> Create a Web application OAuth client
-> Use https://your-domain.com/api/oauth/google/callback as the redirect URI
-> Fill Client ID and Client Secret into ImgBed
-> Click Get Token
-> Sign in with Google and authorize
-> Copy the Refresh Token from the callback page
-> Paste it back into ImgBed and save
-> Upload a test image

ماخذونه

  1. Google OAuth Web Server Applications: https://developers.google.com/identity/protocols/oauth2/web-server
  2. Google Workspace OAuth Consent Configuration: https://developers.google.com/workspace/guides/configure-oauth-consent
  3. Google Drive API Auth Scopes: https://developers.google.com/workspace/drive/api/guides/api-specific-auth

Released as user documentation for CloudFlare ImgBed.