Python rauth.OAuth2Service() Examples
The following are 12
code examples of rauth.OAuth2Service().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
rauth
, or try the search function
.
Example #1
Source File: oauth.py From flask-oauth-example with MIT License | 6 votes |
def __init__(self): super(FacebookSignIn, self).__init__('facebook') self.service = OAuth2Service( name='facebook', client_id=self.consumer_id, client_secret=self.consumer_secret, authorize_url='https://graph.facebook.com/oauth/authorize', access_token_url='https://graph.facebook.com/oauth/access_token', base_url='https://graph.facebook.com/' )
Example #2
Source File: oauth.py From facebook-insights with ISC License | 6 votes |
def get_access_token(self, code, *vargs, **kwargs): long_term = kwargs.get('long_term', False) if 'long_term' in kwargs: del kwargs['long_term'] data = dict( code=code, grant_type='authorization_code', redirect_uri=self.redirect_uri, ) data.update(kwargs.get('data', {})) kwargs['data'] = data token = super(OAuth2Service, self).get_access_token( *vargs, **kwargs) if long_term: token = self.get_long_term_token(token) return token
Example #3
Source File: sites.py From daimaduan.com with BSD 3-Clause "New" or "Revised" License | 5 votes |
def get_oauth_services(): oauth_services = {} oauth_services['google'] = OAuth2Service(**oauth_config(current_app.config, 'google')) oauth_services['github'] = OAuth2Service(**oauth_config(current_app.config, 'github')) return oauth_services
Example #4
Source File: provider.py From listenbrainz-server with GNU General Public License v2.0 | 5 votes |
def init(client_id, client_secret, session_key='musicbrainz'): global _musicbrainz, _session_key _musicbrainz = OAuth2Service( name='musicbrainz', base_url="https://musicbrainz.org/", authorize_url="https://musicbrainz.org/oauth2/authorize", access_token_url="https://musicbrainz.org/oauth2/token", client_id=client_id, client_secret=client_secret, ) _session_key = session_key
Example #5
Source File: auth.py From pheweb with GNU Affero General Public License v3.0 | 5 votes |
def __init__(self, current_app): google_params = self._get_google_info() self.service = OAuth2Service( name='google', client_id=conf.login['GOOGLE_LOGIN_CLIENT_ID'], client_secret=conf.login['GOOGLE_LOGIN_CLIENT_SECRET'], authorize_url=google_params.get('authorization_endpoint'), base_url=google_params.get('userinfo_endpoint'), access_token_url=google_params.get('token_endpoint') )
Example #6
Source File: oauth.py From nomad with Apache License 2.0 | 5 votes |
def __init__(self): super(FacebookSignIn, self).__init__('facebook') self.service = OAuth2Service( name='facebook', client_id=self.consumer_id, client_secret=self.consumer_secret, authorize_url='https://graph.facebook.com/oauth/authorize', access_token_url='https://graph.facebook.com/oauth/access_token', base_url='https://graph.facebook.com/' )
Example #7
Source File: oauth.py From nomad with Apache License 2.0 | 5 votes |
def __init__(self): super(GoogleSignIn, self).__init__('google') googleinfo = urlopen('https://accounts.google.com/.well-known/openid-configuration') google_params = json.load(googleinfo) self.service = OAuth2Service( name='google', client_id=self.consumer_id, client_secret=self.consumer_secret, authorize_url=google_params.get('authorization_endpoint'), base_url=google_params.get('userinfo_endpoint'), access_token_url=google_params.get('token_endpoint') )
Example #8
Source File: yahooapi.py From python-yahooapi with MIT License | 5 votes |
def __init__(self, keyfile, tokenfile=None, base_url="https://fantasysports.yahooapis.com", request_period=0): self.key = ClientKey.from_file(keyfile) self.tokenfile = tokenfile if self.tokenfile and os.path.exists(self.tokenfile): self.token = Token.from_file(self.tokenfile) else: self.token = Token() self.oauth = OAuth2Service( client_id=self.key.client_id, client_secret=self.key.client_secret, name="yahoo", authorize_url="https://api.login.yahoo.com/oauth2/request_auth", access_token_url="https://api.login.yahoo.com/oauth2/get_token", base_url=base_url, ) self.session = None self._update_token() self.session = self.oauth.get_session(self.token.access_token) self.last_request = time.time() self.request_period = request_period
Example #9
Source File: oauth.py From facebook-insights with ISC License | 5 votes |
def __init__(self, *vargs, **kwargs): options = dict( authorize_url='https://graph.facebook.com/oauth/authorize', access_token_url='https://graph.facebook.com/oauth/access_token', base_url='https://graph.facebook.com/', ) options.update(**kwargs) self.redirect_uri = options.get('redirect_uri') if 'redirect_uri' in options: del options['redirect_uri'] super(OAuth2Service, self).__init__(*vargs, **options)
Example #10
Source File: oauth.py From facebook-insights with ISC License | 5 votes |
def get_authorize_url(self, *vargs, **kwargs): options = dict( scope='manage_pages,read_insights', response_type='code', redirect_uri=self.redirect_uri, ) options.update(**kwargs) return super(OAuth2Service, self).get_authorize_url(*vargs, **options)
Example #11
Source File: oauth.py From facebook-insights with ISC License | 5 votes |
def authorize(client_id, client_secret): facebook = OAuth2Service( client_id=client_id, client_secret=client_secret, redirect_uri=REDIRECT_URI, ) user_token = authorize_user(facebook, long_term=True) page_tokens = authorize_pages(facebook, user_token) return page_tokens
Example #12
Source File: provider.py From acousticbrainz-server with GNU General Public License v2.0 | 5 votes |
def init(client_id, client_secret, session_key='musicbrainz'): global _musicbrainz, _session_key _musicbrainz = OAuth2Service( name='musicbrainz', base_url="https://musicbrainz.org/", authorize_url="https://musicbrainz.org/oauth2/authorize", access_token_url="https://musicbrainz.org/oauth2/token", client_id=client_id, client_secret=client_secret, ) _session_key = session_key