+ 1# Copyright (C) 2011 Google Inc.
+ 2#
+ 3# Licensed under the Apache License, Version 2.0 (the "License");
+ 4# you may not use this file except in compliance with the License.
+ 5# You may obtain a copy of the License at
+ 6#
+ 7# http://www.apache.org/licenses/LICENSE-2.0
+ 8#
+ 9# Unless required by applicable law or agreed to in writing, software
+ 10# distributed under the License is distributed on an "AS IS" BASIS,
+ 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ 12# See the License for the specific language governing permissions and
+ 13# limitations under the License.
+ 14
+ 15"""Utilities for reading OAuth 2.0 client secret files.
+ 16
+ 17A client_secrets.json file contains all the information needed to interact with
+ 18an OAuth 2.0 protected service.
+ 19"""
+ 20
+ 21__author__='jcgregorio@google.com (Joe Gregorio)'
+ 22
+ 23
+ 24fromanyjsonimportsimplejson
+ 25
+ 26# Properties that make a client_secrets.json file valid.
+ 27TYPE_WEB='web'
+ 28TYPE_INSTALLED='installed'
+ 29
+ 30VALID_CLIENT={
+ 31TYPE_WEB:{
+ 32'required':[
+ 33'client_id',
+ 34'client_secret',
+ 35'redirect_uris',
+ 36'auth_uri',
+ 37'token_uri'],
+ 38'string':[
+ 39'client_id',
+ 40'client_secret'
+ 41]
+ 42},
+ 43TYPE_INSTALLED:{
+ 44'required':[
+ 45'client_id',
+ 46'client_secret',
+ 47'redirect_uris',
+ 48'auth_uri',
+ 49'token_uri'],
+ 50'string':[
+ 51'client_id',
+ 52'client_secret'
+ 53]
+ 54}
+ 55}
+ 56
+