https://github.com/eattrenclenhard/sho-time
A simple self-hosted web app for authorising selected Google API Oauth2 scopes. Supports Google Drive, Google Photos and Youtube
https://github.com/eattrenclenhard/sho-time
google-cloud-api google-oauth2 google-photos-api python3 streamlit
Last synced: about 1 year ago
JSON representation
A simple self-hosted web app for authorising selected Google API Oauth2 scopes. Supports Google Drive, Google Photos and Youtube
- Host: GitHub
- URL: https://github.com/eattrenclenhard/sho-time
- Owner: eattrenclenhard
- Created: 2025-01-29T22:01:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-31T09:25:11.000Z (about 1 year ago)
- Last Synced: 2025-03-31T10:30:51.212Z (about 1 year ago)
- Topics: google-cloud-api, google-oauth2, google-photos-api, python3, streamlit
- Language: Python
- Homepage: https://shotime.streamlit.app
- Size: 30.9 MB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# About
A simple self-hosted web app for authorising selected Google API Oauth2 scopes via self-defined API credentials. Supports
Google Drive, Google Photos and Youtube.
# Use Case Scenario
This app provides an intuitive and a straightforward way for user to perform OAuth flow authorisation process to grant certain level of access to specific
parts Google services via self-defined API client credentials to third party app such as rclone and alist etc.
I built this app with privacy and data protection in mind. I have security and privacy concerns over public services who
offer to generate tokens or refresh code. For one, I might have ended up granting broader scopes than necessary in
public token generator when the app would work just the same by providing just enough privilege and level access. Number
two, the public token generator will definitely have access to the finalized token which can then be used to access whichever
scopes you've granted previously. What he does with it is up to anyone's guess.
Thus, I decided to take it upon my shoulders to provide a GUI option for users who wish to grant third party access to
specific Google services but opt for custom API client instead.
> [!IMPORTANT]
> Please refrain from using the demo
app I've deployed to generate access token, please deploy **your own** copy instead.
# Features
- supports headless machine, GUI environment is **not** required for completing OAuth 2.0 flow
- self-hosted, full control over your own data
- privacy-oriented, manually clear session anytime you want to start over or exit
- clears record every 12 hours
- open-source
- light-weight design
- cookie support, remembers last used state
- fine-grained control over level of access(read-only or full access)
- convenient deployment via Streamlit
# How to deploy?
Prerequisites
1. Head over to [Google cloud console](https://console.cloud.google.com), create your project if you haven't already and
download your client secret. Make sure to select 'Web application' from the 'Application type' dropdown-menu when
you're creating OAuth client
ID. 
2. Under the 'Authorised redirect URIs' section, fill in the redirect URI at which your app is hosted. For example, in
local streamlit environment, the app is usually hosted at http://localhost:8501. Copy or rename
`.streamlit/secrets.toml.sample` to `.streamlit/secrets.toml` and ensure the redirect URI specified in Google Cloud
Project->Credentials->OAuth client ID section match that of `.streamlit/secrets.toml` file. Once again, ensure both
values are the same and end with this exact trailing path, **/callback**. For example,
`http://localhost/8501/callback` 
3. Finally, download the credential json file for your OAuth2 client ID.

---
Direct Deployment (recommended)
1. You may deploy this app locally or remotely. Ensure you have python3 installed.
2. Get a copy of this repository via git clone (forking your own copy is recommended) and in your CLI, head over to the project root.
3. Install packages with `pip install -r requirements.txt`.
4. Start and execute the app with `streamlit run Home.py`.
5. You should see your app up and running at port 8501 or whichever port that's specified in the terminal if 8501 has been occupied.

---
via Streamlit Community Cloud
1. Sign in or register [here](https://share.streamlit.io).
2. Click the 'fork' button on the top right corner of my [demo](https://shotime.streamlit.app) app to fork and deploy your own copy. 
3. Fill in the Github repository containing the source code. For example `eattrenclenhard/Sho-Time` or your own repo.
4. Select 'Home.py' as entry point under 'Main file path'
5. Fill in the base URL of your app, has to match that of step 6.
6. In 'Advanced settings', fill in the URL where your app is going to be hosted on Streamlit, remember, it has to match any of the URIs you filled in earlier in Google Cloud console Client ID section and has to match that of step 5.


---
via Docker
WIP
# Preview
https://shotime.streamlit.app
