This is a simple gitkit (Google identity toolkit) demo via GAE python webapp2 framework
###Getting Started
####Step 1: Clone repo.
git clone https://github.com/cage1016/gitkit-webapp2
####Step 2: install packages.
install python third-party libraries
sudo python install -r requestments.txt -t lib
####Step 3: Create GAE project
Please visit your Google Developers Console and choose one project or create new one project.
Create client id for web application
-
Click APIs & Auth > credential.
-
Click Click new Client ID.
-
Choose Web application.
-
modify Authorized JavaScript origins.
http://localhost:8080
-
modify Authorized redirect URIs.
http://localhost:8080/widget
-
Click Create Client ID
Create Service Account
-
Click APIs & Auth > credential.
-
Click Click new Client ID.
-
Choose Service Account.
-
Key type : P12 Key
-
Click Create Client ID
-
P12.Key file will be downloaded. You have to convert
p12
topem
cause PKCS12 format is not supported by the PyCrypto library.(openssl pkcs12 -in xxxxx.p12 -nodes -nocerts > privatekey.pem)
Create Public API access
- Click APIs & Auth > credential.
- Click Click new Key in Public API access section
- Click Browser key
- Click Create
####Step 4
Enable Identity Toolkit API and setup
-
Click APIs & Auth > APIs > API Library.
-
Search Identity Toolkit API and turn it on.
-
switch Enabled APIs and Click Identity Toolkit API setting icon.
-
Click API Configuration
-
Click origin console. you will swtich old google console
-
Fill the Identity Toolkit setting
- set Sign-in Success URL: /signin
- set Sign-out URL: /logou
- set Send Email URL: /
-
Click Server-side configuration file Download to download
gitkit-server-config.json
{ "clientId" : "<your-client-id>", "serviceAccountEmail" : "<your-service-account-email>", "serviceAccountPrivateKeyFile" : "INSERT/PATH/TO/PRIVATEKEY", "widgetUrl" : "http://localhost:8080/widget", "cookieName" : "gtoken" }
modify
INSERT/PATH/TO/PRIVATEKEY
with<your-pem-file>
path you just converted. -
Fill the Facebook ClientID and Secret key if you want to gitkit support faebook signin.
####Step 5
modify templates/widget.html
as <your-public-api-key>
your created
var config = {
apiKey: '<your-public-api-key>',
signInSuccessUrl: '/signin',
idps: ["google"],
oobActionUrl: '/',
####Step 6
You can run gitkit locally now
dev_appserver.py .
###Reference