GithubHelp home page GithubHelp logo

plus_sign_in's Introduction

Google+ Sign-In Python Test App

In order to explore the Google+ Sign-In API I wrote a few test programs based on the python and javascript quick start applications. For more information about this API see https://developers.google.com/+/web/signin/.

This example makes use of the Bottle web framework and the Beaker sessions library. Prior to running the application, you must install the following libraries:

To run this demo you must register your application on the Google APIs Console. Be sure to request access for the Google+ API service and from the JavaScript origin http://localhost:9021/. You can leave Redirect URIs blank as the javascript handles the first part of the OAuth2 exchange.

Retrieve your Client ID and Client Secret and place them in the appropriate areas of the client_secrets.json file. Then you can run the signin.py program. This will start a server on port 9021 which you can reach using the URL http://localhost:9021/.

The endpoint http://localhost:9021/ creates a page which performs the server-side OAuth2 flow using a one-time code provided by a javascript authorization request as described here https://developers.google.com/+/web/signin/server-side-flow . There is also a version at http://localhost:9021/staticjs which performs client-side flow to display the same page. More information about that method is found here https://developers.google.com/+/web/signin/#using_the_client-side_flow .

When performing server-side flow credentials are saved in the credentials directory for each authorized user. The offline_fetch.py program demonstrates how to use those credentials to perform API calls from the server.

An important realization I had when going through the samples is that google will generate only 1 refresh token for every client id/user pair. Therefore when that refresh token is present, you should save the credentials if you need to make offline calls to the API on behalf of the user. In the server-side example I check if a refresh token is present and save the credentials in that case.

plus_sign_in's People

Contributors

devries avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.