mirror of
https://github.com/mudabbir-ahmad/Media-Aggregation-and-Sorting-System.git
synced 2026-10-07 19:40:20 +00:00
refactor app configuration and improve Google OAuth handling; update .gitignore and enhance test documentation
This commit is contained in:
1 parent
cb74405f5f
commit
d865708e28
6 files changed
+79
-41
No files matched your search
+20
-19
@@ -1,22 +1,23 @@
|
||||
/**
|
||||
* Google Photos OAuth & API Test
|
||||
*
|
||||
* Usage:
|
||||
* node TEST/testGooglePhotosAPI.js <ACCESS_TOKEN>
|
||||
* GOOGLE_ACCESS_TOKEN=ya29.xxx node TEST/testGooglePhotosAPI.js
|
||||
*
|
||||
* How to get a token for manual testing:
|
||||
* 1. Go to https://developers.google.com/oauthplayground
|
||||
* 2. Select "Photos Library API v1" → photoslibrary scope
|
||||
* 3. Authorise the API
|
||||
* 4. Exchange the authorization code for tokens
|
||||
* 5. Copy the access token and pass it to this script
|
||||
*
|
||||
* Tests:
|
||||
* 1. Validates the token against the userinfo endpoint
|
||||
* 2. Lists media items from Google Photos
|
||||
* 3. Lists albums from Google Photos
|
||||
*/
|
||||
// Google Photos API Test
|
||||
//
|
||||
// Usage:
|
||||
// node TEST/testGooglePhotosAPI.js <ACCESS_TOKEN>
|
||||
// GOOGLE_ACCESS_TOKEN=ya29.xxx node TEST/testGooglePhotosAPI.js
|
||||
//
|
||||
// Getting a token from OAuth Playground (https://developers.google.com/oauthplayground):
|
||||
// 1. Click the gear icon → check "Use your own OAuth credentials"
|
||||
// 2. Enter your Client ID and Client Secret from Google Cloud Console
|
||||
// 3. In the left panel select ALL of these scopes:
|
||||
// https://www.googleapis.com/auth/photoslibrary
|
||||
// https://www.googleapis.com/auth/photoslibrary.appendonly
|
||||
// https://www.googleapis.com/auth/userinfo.email
|
||||
// https://www.googleapis.com/auth/userinfo.profile
|
||||
// 4. Click "Authorize APIs" and sign in with your test Google account
|
||||
// 5. Click "Exchange authorization code for tokens"
|
||||
// 6. Copy the Access token (starts with ya29.) and pass it here
|
||||
//
|
||||
// Note: if you only see 403 PERMISSION_DENIED, the token was issued without
|
||||
// the photoslibrary scope — go back and re-authorise with all scopes above.
|
||||
|
||||
const API_BASE = 'https://photoslibrary.googleapis.com/v1';
|
||||
const USERINFO_URL = 'https://www.googleapis.com/oauth2/v2/userinfo';
|
||||
|
||||
Reference in new issue
Block a user