当前位置: 首页>>代码示例>>Python>>正文


Python oauth20_account.OAuthAccount类代码示例

本文整理汇总了Python中gluon.contrib.login_methods.oauth20_account.OAuthAccount的典型用法代码示例。如果您正苦于以下问题:Python OAuthAccount类的具体用法?Python OAuthAccount怎么用?Python OAuthAccount使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了OAuthAccount类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, channel):
        """
            Constructor

            @param channel: Facebook channel (Row) with API credentials:
                            {app_id=clientID, app_secret=clientSecret}
        """

        from facebook import GraphAPI, GraphAPIError

        self.GraphAPI = GraphAPI
        self.GraphAPIError = GraphAPIError

        request = current.request
        settings = current.deployment_settings

        scope = "email,user_about_me," \
                "user_location,user_photos," \
                "user_relationships,user_birthday,user_website," \
                "create_event,user_events,publish_stream"

        # Set the redirect URI to the default/facebook controller
        redirect_uri = "%s/%s/default/facebook/login" % \
                       (settings.get_base_public_url(), request.application)

        OAuthAccount.__init__(self,
                              client_id = channel.app_id,
                              client_secret = channel.app_secret,
                              auth_url = self.AUTH_URL,
                              token_url = self.TOKEN_URL,
                              scope = scope,
                              redirect_uri = redirect_uri,
                              )
        self.graph = None
开发者ID:mauld,项目名称:eden,代码行数:34,代码来源:s3oauth.py

示例2: __init__

 def __init__(self):
     OAuthAccount.__init__(self, None, FB_CLIENT_ID, FB_CLIENT_SECRET,
                           self.AUTH_URL, self.TOKEN_URL,
                           scope='email,user_about_me,user_activities, user_birthday, user_education_history, user_groups, user_hometown, user_interests, user_likes, user_location, user_relationships, user_relationship_details, user_religion_politics, user_subscriptions, user_work_history, user_photos, user_status, user_videos, publish_actions, friends_hometown, friends_location,friends_photos',
                           state="auth_provider=facebook",
                           display='popup')
     self.graph = None
开发者ID:TrendSpace,项目名称:TrendSpace,代码行数:7,代码来源:db.py

示例3: __init__

    def __init__(self, g):

        #import pdb;pdb.set_trace()
        OAuthAccount.__init__(self, g, "248577781948157", "a5abf06a362c8f0fa4cf5da339906185",
                              self.AUTH_URL, self.TOKEN_URL,
                              scope='user_photos,friends_photos')
        self.graph = None
开发者ID:helloiloveit,项目名称:helloFacebook,代码行数:7,代码来源:db.py

示例4: __init__

    def __init__(self, g, db):

        OAuthAccount.__init__(self, g, CLIENT_ID, CLIENT_SECRET,
                              self.AUTH_URL, self.TOKEN_URL,
                              scope='publish_actions, publish_stream, user_likes')
        self.graph = None
        self.db = db
开发者ID:relsi,项目名称:web2social,代码行数:7,代码来源:facebook_account.py

示例5: __init__

    def __init__(self):
        with open(os.path.join(request.folder, 'private/google_auth.json'), 'rb') as f:
            gai = Storage(json.load(f)['web'])

        OAuthAccount.__init__(self, None, gai.client_id, gai.client_secret,
                              gai.auth_uri, gai.token_uri,
                              scope='https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email',
                              approval_prompt='force', state="auth_provider=google")
开发者ID:arturocuma,项目名称:general_ledger,代码行数:8,代码来源:db.py

示例6: __init__

 def __init__(self):
     OAuthAccount.__init__(self, None, VK_CLIENT_ID, VK_CLIENT_SECRET,
                           self.AUTH_URL, self.TOKEN_URL,
                           scope='offline',
                           response_type='code',
                           # state="auth_provider=vk",
     )
     self.graph = None
开发者ID:Infernion,项目名称:spendtime_web2py,代码行数:8,代码来源:db.py

示例7: __init__

 def __init__(self):
    OAuthAccount.__init__(self,
                          client_id=CLIENT_ID,
                          client_secret=CLIENT_SECRET,
                          auth_url=self.AUTH_URL,
                          token_url=self.TOKEN_URL,
                          scope='manage_pages,read_stream,publish_stream,email,user_photos,friends_photos')
    self.graph = None
开发者ID:bachbouch,项目名称:intministry,代码行数:8,代码来源:_db_facebook.py

示例8: __init__

 def __init__(self):
     OAuthAccount.__init__(
         self,
         client_id - CLIENT_ID,
         client_secret=CLIENT_SECRET,
         auth_url=self.AUTH_URL,
         token_url=self.TOKEN_URL,
         scope="none",
     )
开发者ID:sonal-swarnima,项目名称:baadal2.0,代码行数:9,代码来源:iitd_oauth.py

示例9: __init__

 def __init__(self):
    OAuthAccount.__init__(self,
                          client_id=CLIENT_ID,
                          client_secret=CLIENT_SECRET,
                          auth_url=self.AUTH_URL,
                          token_url=self.TOKEN_URL,
                          scope='email')
    self.graph = None
    self.app_graph = None
开发者ID:bachbouch,项目名称:reform_tn,代码行数:9,代码来源:_db_facebook.py

示例10: __init__

 def __init__(self, db):
     self.db = db
     g = dict(GraphAPI=GraphAPI,
              GraphAPIError=GraphAPIError,
              request=current.request,
              response=current.response,
              session=current.session,
              HTTP=HTTP)
     client = dict(db.config.get_list('auth', 'facebook'))
     OAuthAccount.__init__(self, g, client['id'], client['secret'],
                           self.AUTH_URL, self.TOKEN_URL,
                           scope='email,user_about_me,user_location,user_photos,user_relationships,user_birthday,user_website,create_event,user_events,publish_stream')
     self.graph = None
开发者ID:1nn7erplay,项目名称:Movuca,代码行数:13,代码来源:facebook.py

示例11: __init__

    def __init__(self):
        OAuthAccount.__init__(self, 
                              g=globals(),
                              client_id=CLIENT_ID,
                              client_secret=CLIENT_SECRET,
                              auth_url=self.AUTH_URL,
                              token_url=self.TOKEN_URL,
                              redirect_uri=REDIRECT_URI,
                              state=os.urandom(16).encode('hex'),
                                  # random string to detect cross-site request forgery
                              scope='public_repo')  # add ',repo' if including private repos

        # adding session here, since older OAuthAccount doesn't seem to have it.. :-/
        self.session = globals()['session']
开发者ID:BioinformaticsArchive,项目名称:opentree,代码行数:14,代码来源:db.py

示例12: __init__

    def __init__(self, channel):

        from facebook import GraphAPI, GraphAPIError

        self.GraphAPI = GraphAPI
        self.GraphAPIError = GraphAPIError
        g = dict(GraphAPI=GraphAPI,
                 GraphAPIError=GraphAPIError,
                 request=current.request,
                 response=current.response,
                 session=current.session,
                 HTTP=HTTP)

        OAuthAccount.__init__(self, g, channel.app_id, channel.app_secret,
                              self.AUTH_URL, self.TOKEN_URL,
                              scope="email,user_about_me,user_location,user_photos,user_relationships,user_birthday,user_website,create_event,user_events,publish_stream")
        self.graph = None
开发者ID:Alatec,项目名称:eden,代码行数:17,代码来源:s3oauth.py

示例13: __init__

     def __init__(self,g=globals()):
         OAuthAccount.__init__(self,g,client_id=cl_id,client_secret=cl_secret,auth_url=self.auth_url,token_url=self.token_url,state='xyz')
      
         def get_user(self):
             token=self.accessToken()
             if not token:
                 return None
             
             uri=config.get("OAUTH_CONF","resource_url")
             r=requests.get(uri,params={'access_token':token})
             userdata=r.json()
             user_info={}
             if ' ' in userdata['name']:
                 #user_info['first_name'],user_info['middle_name'],user_info['last_name']=userdata['name'].split()
                 data=userdata['name'].split()
                 if len(data) > 2:
                     user_info['first_name']=data[0]
                     user_info['middle_name']=data[1]
                     user_info['last_name']=data[2]
                 else:
                     user_info['first_name']=data[0]
                     user_info['last_name']=data[1]
             else: 
                 user_info['first_name']=userdata['name']
                 user_info['last_name']=' '
 
             user_info['user_name'] = userdata['user_id']
             user_info['email'] = userdata['email']
 
             user_info['roles'] = fetch_user_role(user_info['user_name'])
             # If user has super admin rights; it is added to separate organization
             if current.ADMIN in user_info['roles']:
                 user_info['organisation'] = 'ADMIN'
             else:
                 user_info['organisation'] = 'IITD'
             create_or_update_user(user_info, False) 
             return dict(first_name=user_info['first_name'],last_name=user_info['last_name'],email=userdata['email'],username = userdata['user_id'] )
开发者ID:sonal-swarnima,项目名称:baadal2.0,代码行数:37,代码来源:db.py

示例14: __init__

 def __init__(self, g):
     OAuthAccount.__init__(self, g, "231547190343989", "05003c7c704ca6d524fbd84ac0a1dd46",
                           self.AUTH_URL, self.TOKEN_URL,
                           )
     self.graph = None
开发者ID:logyuan,项目名称:fbmayor,代码行数:5,代码来源:db.py

示例15: __init__

 def __init__(self):
     OAuthAccount.__init__(self, None, STRAVA_CLIENT_ID, STRAVA_CLIENT_SECRET,
                           self.AUTH_URL, self.TOKEN_URL,
                           response_type='code',
                           approval_prompt='auto') # 'force' to force strava auth on every login
     self.client = None
开发者ID:nkall,项目名称:SegTracker,代码行数:6,代码来源:auth.py


注:本文中的gluon.contrib.login_methods.oauth20_account.OAuthAccount类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。