From 73566647ea9066d0ce9890979bbb4f97f53dc7c1 Mon Sep 17 00:00:00 2001 From: mudabbir-ahmad Date: Tue, 24 Feb 2026 21:15:04 +0000 Subject: [PATCH] reverted? --- ignorefiles/GOOGLE_OAUTH_SETUP.md | 52 +++++++++++++++++++++++++++++++ ignorefiles/INSTALL_COMMANDS.md | 30 ++++++++++++------ package.json | 14 +++++++-- src/AUTH/GoogleAUTH.js | 3 +- 4 files changed, 85 insertions(+), 14 deletions(-) create mode 100644 ignorefiles/GOOGLE_OAUTH_SETUP.md diff --git a/ignorefiles/GOOGLE_OAUTH_SETUP.md b/ignorefiles/GOOGLE_OAUTH_SETUP.md new file mode 100644 index 0000000..f0e9a3d --- /dev/null +++ b/ignorefiles/GOOGLE_OAUTH_SETUP.md @@ -0,0 +1,52 @@ +# Google OAuth Setup for Android APK + +## Step 1: Create a Google Cloud Project +1. Go to https://console.cloud.google.com/ +2. Click **Select a project** → **New Project** +3. Name it and click **Create** + +## Step 2: Enable the Photos Library API +1. Go to **APIs & Services** → **Library** +2. Search for **Photos Library API** → Enable it + +## Step 3: Configure the OAuth Consent Screen +1. Go to **APIs & Services** → **OAuth consent screen** +2. Choose **External** → **Create** +3. Fill in: + - **App name**: MASS Photo App + - **User support email**: your email + - **Developer contact**: your email +4. **Scopes** → Add or Remove Scopes: + - `openid` + - `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` +5. **Test users** → Add your Google account email address + +## Step 4: Create an Android OAuth Client ID +1. Go to **APIs & Services** → **Credentials** +2. **+ Create Credentials** → **OAuth client ID** +3. Application type: **Android** +4. Package name: `com.bobthebob.massphotoapp` +5. SHA-1 certificate fingerprint: get it by running `eas credentials --platform android` +6. Click **Create** and copy the **Client ID** +7. Open `src/AUTH/GoogleAUTH.js` and set `ANDROID_CLIENT_ID` to the copied value + +## How it works +- The **Android client ID** is used for both the authorization request and the + token exchange. Google verifies the request using the app's package name + + SHA-1 signing certificate, so no redirect URI registration is needed. +- The redirect goes to `com.bobthebob.massphotoapp:/oauthredirect` which + Android routes back into the app via the intent filter in `app.json`. +- Android clients are public (no `client_secret` required). PKCE `code_verifier` + is used to secure the authorization code exchange. + +## Testing the API with OAuth Playground +1. Go to https://developers.google.com/oauthplayground +2. Click the gear icon → check "Use your own OAuth credentials" +3. You will need a **Web application** client for the playground only (the + playground cannot use Android clients). Create one in the console if needed, + add `https://developers.google.com/oauthplayground` to its redirect URIs. +4. Select Photos Library API scopes and authorize +5. Copy the access token and run: `node TEST/testGooglePhotosAPI.js ` diff --git a/ignorefiles/INSTALL_COMMANDS.md b/ignorefiles/INSTALL_COMMANDS.md index 04d7b74..1b8001c 100644 --- a/ignorefiles/INSTALL_COMMANDS.md +++ b/ignorefiles/INSTALL_COMMANDS.md @@ -1,27 +1,37 @@ # Install Commands -## Client App (root folder) +## Client App (project root) + ```bash -npm install expo expo-sqlite expo-crypto expo-secure-store expo-auth-session expo-web-browser expo-linking expo-blur expo-file-system expo-image-picker expo-media-library expo-status-bar react react-native @react-navigation/native @react-navigation/native-stack @react-navigation/bottom-tabs react-native-safe-area-context react-native-screens axios @babel/core +npx expo install expo expo-sqlite expo-crypto expo-secure-store expo-auth-session expo-web-browser expo-linking expo-blur expo-file-system expo-image-picker expo-media-library expo-status-bar react react-native react-native-reanimated react-native-gesture-handler react-native-worklets react-native-safe-area-context react-native-screens @react-navigation/native @react-navigation/native-stack @react-navigation/bottom-tabs axios @babel/core ``` -## NAS Backend Server (ServerFiles folder) +## NAS Backend (ServerFiles folder) + ```bash -cd ServerFiles && npm install express cors dotenv jsonwebtoken express-fileupload body-parser node-fetch@2 nodemon +cd ServerFiles && npm install && cd .. ``` -## Quick Setup (both at once) -```bash -npm install && cd ServerFiles && npm install && cd .. -``` +## Quick Setup -## Version Fix (if React version mismatch) ```bash -npx expo install --fix +npx expo install --fix && cd ServerFiles && npm install && cd .. ``` ## Clear Cache + Rebuild + ```bash npx expo start --clear ``` +## Run the NAS Backend Server + +```bash +cd ServerFiles && node server.js +``` + +Or from the project root: + +```bash +npm run backend +``` diff --git a/package.json b/package.json index 9b9a2c2..f94659f 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "main": "index.js", "scripts": { "start": "expo start", - "android": "expo start --android", - "ios": "expo start --ios", + "android": "expo run:android", + "ios": "expo run:ios", "web": "expo start --web", "backend": "node ServerFiles/server.js" }, @@ -39,5 +39,15 @@ "@babel/core": "^7.29.0", "babel-preset-expo": "~12.0.0" }, + "overrides": { + "jscodeshift": "0.16.1", + "chromium-edge-launcher": "0.3.0", + "temp": { + "rimraf": "^4.0.0" + }, + "rimraf": { + "glob": "^10.0.0" + } + }, "private": true } \ No newline at end of file diff --git a/src/AUTH/GoogleAUTH.js b/src/AUTH/GoogleAUTH.js index 62f409c..3e30b8e 100644 --- a/src/AUTH/GoogleAUTH.js +++ b/src/AUTH/GoogleAUTH.js @@ -9,8 +9,7 @@ WebBrowser.maybeCompleteAuthSession(); // Created in Google Cloud Console as "Android" type with package name // com.bobthebob.massphotoapp and the SHA-1 from `eas credentials --platform android`. // Android clients are public (no client_secret needed) — PKCE verifies instead. -const ANDROID_CLIENT_ID = "313090284964-018uf4v1bmmrra09lvmpnuug2qs09047.apps.googleusercontent.com" -//'313090284964-pa9p2rs7g60l9t8hr6haee3qbn2a7vl9.apps.googleusercontent.com'; +const ANDROID_CLIENT_ID = '313090284964-018uf4v1bmmrra09lvmpnuug2qs09047.apps.googleusercontent.com'; const GOOGLE_DISCOVERY = { authorizationEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth',