Just another Google-like go/ short-link service, deployed on GCP and integrated with G Suite!
While volunteering at Google Beijing, I learned that Google has an internal URL shortener that allows users to register URL shortcuts for lengthy URLs. For example, if you are interested in the first release preview of Flutter, you only need to visit http://go/flutter-rp1. You want to see the blog post about it? Sure, just visit http://go/flutter-rp1-blog! Those links can even be easily printed out on paper, and also easily remembered. Life is a lot easier with those links.
According to Kelly Norton, this was originally implemented at Google by Benjamin Staffin to end the never-ending stream of requests for internal CNAME entries. He described it as AOL keywords for the corporate network.
Many companies now have something similar, and there's even a "go/ link as a service": golinks.io. This is my personal implementation, originally designed for MUNPANEL, a student project of mine.
It's built on top of Google App Engine, and Google Cloud Datastore, so it scales really well, and is really easy to deploy. It's written in Python 2.7, and I haven't tested support for Python 3, but feel free to send a pull request if changes are needed to support Python 3. It calls Google's OAuth API so it can integrate with your G Suite for SSO (Single-Sign On) and access control. For more advanced access control, it integrates with Google Groups. It also has a pretty (imo) UI built with Material Design Lite.
As mentioned before, there are go link as a service
platforms but it's not customizable enough
to suit individual needs and they are expensive to use. Security is another concern since it's
closed-source and hosted by third-party.
Kelly Norton wrote a decent one in Golang, but it needs to be deployed in a container/VM. It also lacks advanced features and doesn't support any sort of Access Control.
So I decided to write my own. It's deployed on Google App Engine so it's much easier to maintain and scale. It integrates directly with G Suite. It also integrates with Google Groups for more advanced access control.
You can easily log in to your G Suite account, view the links you created, create new links, modify links, delete links, and see how many times your links have been clicked, all on the web portal.
For every link, you can specify whether it requires G Suite login. You can also specify if it requires G Suite user to belong to certain Google Groups to access that specific URL.
- Create a new GCP project.
pip install -t lib -r requirements.txt
- Copy
config.py.example
toconfig.py
and modify accordingly gcloud app deploy app.yaml
- Go to GCP app engine settings, set
Google authentication
toGoogle Apps domain
for G Suite integration - In App Engine settings, configure your custom domain (e.g. go.corp.munpanel.com)
- Visit the domain you just set, and enjoy :-)
We support integration with Google Groups for more advanced access control on top of regular G Suite integration. For each link, you can specify users in which internal Google Group have access.
To set up Google Groups Integration, follow the following steps:
- Turn on
ENABLE_GOOGLE_GROUPS_INTEGRATION
inconfig.py
and setGSUITE_DIRECTORY_ADMIN_USER
to a G Suite admin user in your domain. - Go to Service Accounts settings for your
GCP project and create a new service account (you don't need to grant any GCP project or user access to
the service account); enable
G Suite Domain-wide Delegation
for it. Download json format key and put it ascredentials.json
in your GAE project root. - Go to G Suite Admin, select
Security
,Advanced Setttings
,Manage API Access
- Authorize a new access, set
Client Name
to theClient ID
underG Suite Domain-wide Delegation
, set scope tohttps://www.googleapis.com/auth/admin.directory.group.readonly, https://www.googleapis.com/auth/admin.directory.group.member.readonly
- Go to GCP API Library and enable
Admin SDK
API for your GCP project.
Contribution is welcome! Feel free to send pull requests ^_^
This product is neither endorsed nor supported by Google LLC.