Skip to content

Repository files navigation

AbY

Repository for Abhishek Yadav

Useful Note

  1. Set the OAuth Consent Screen to "External"

Go to the Google Cloud Console. Navigate to APIs & Services > OAuth consent screen. Make sure the User Type is set to External (so non-organization users can log in). 2. Add them as "Test Users"

Because your app requests full Google Drive access (https://www.googleapis.com/auth/drive), Google considers it a "restricted scope". To avoid a lengthy security review process by Google, keep the Publishing status as Testing. Scroll down on the OAuth consent screen page to the Test users section and add the Gmail addresses of the friends/users you are giving the app to. Only these specific emails will be allowed to log in. 3. Authorized JavaScript Origins

If you are hosting this index.html on a website (e.g., GitHub Pages, a personal domain), make sure that domain URL is added under Authorized JavaScript origins in your OAuth 2.0 Client ID settings. If you are just giving them the .html file to open locally, ensure http://localhost is in the authorized origins (if they run a local server). Note: Modern Google Identity Services strongly prefers the app to be hosted on https:// or http://localhost rather than opening the file directly via file://. 4. Secure your API Key (Highly Recommended)

Since your API_KEY is visible in the HTML source code, anyone could copy it and use it on their own website, consuming your Google Cloud quota. Go to APIs & Services > Credentials, click your API Key, and under Application restrictions, select HTTP referrers (web sites). Add the exact URL where you are hosting your app (e.g., https://your-domain.com/*). This ensures the key only works when the request comes from your specific app. In short, your code is good to go! Just configure the Google Cloud Console settings, host the file somewhere, and your users will be safely saving data to their own drives.

Moving Web to Android Project

  • npm init -y npm install vite @capacitor/core @capacitor/cli @capacitor/android @codetrix-studio/capacitor-google-auth

  • Copy all *.html, *.css, *.js, *.png, *.mp4 to root

  • npx cap init AbYSafe com.abysafe.app --web-dir dist npx cap add android

  • Update apacitor.config.json

{
  "appId": "com.abysafe.app",
  "appName": "AbYSafe",
  "webDir": "dist",
  "plugins": {
    "GoogleAuth": {
      "scopes": ["profile", "email", "https://www.googleapis.com/auth/drive"],
      "serverClientId": "1032411851512-8digdid2op35klkl68gejrempduqshu3.apps.googleusercontent.com",
      "forceCodeForRefreshToken": true
    }
  }
}
  • Step 4: Configure Google Cloud For Android For native Android logins, Google requires strict validation (so no one else can spoof your app).

    Go to your Google Cloud Console > APIs & Services > Credentials. Click Create Credentials > OAuth client ID. Choose Android. Set the Package name to com.abysafe.app. It will ask for your SHA-1 certificate fingerprint. You can easily get this from Android Studio when you build the APK, or by running ./gradlew signingReport in the android directory. Important: Create a Firebase Project linked to your Google Cloud project, register your Android App (com.abysafe.app), download the google-services.json file, and place it in AbYSafeMobile/android/app/.

  • Whenever change code do this npx vite build npx cap sync

  • Build in Android Studio npx cap open android

  • In Android Studio, click Build > Build Bundle(s) / APK(s) > Build APK(s), and send the file to your phone!

About

Repository for Abhishek Yadav

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages