Skip to content

Commit

Permalink
Contrib-OAuth1: send signal "request_token_fetched" by blinker.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyseek committed May 20, 2015
1 parent 7909721 commit ad2fc37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions flask_oauthlib/contrib/client/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from .descriptor import OAuthProperty, WebSessionData
from .structure import OAuth1Response, OAuth2Response
from .exceptions import AccessTokenNotFound
from .signals import request_token_fetched


__all__ = ['OAuth1Application', 'OAuth2Application']
Expand Down Expand Up @@ -179,9 +180,8 @@ def authorize(self, callback_uri, code=302):
oauth = self.make_oauth_session(callback_uri=callback_uri)

# fetches request token
oauth.fetch_request_token(self.request_token_url)
# TODO send signal and pass token here
# http://flask.pocoo.org/docs/0.10/signals/
token = oauth.fetch_request_token(self.request_token_url)
request_token_fetched.send(self, response=OAuth1Response(token))
# TODO check oauth_callback_confirmed here
# http://tools.ietf.org/html/rfc5849#section-2.1

Expand Down
6 changes: 6 additions & 0 deletions flask_oauthlib/contrib/client/signals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from flask.signals import Namespace

__all__ = ['request_token_fetched']

_signals = Namespace()
request_token_fetched = _signals.signal('request-token-fetched')

0 comments on commit ad2fc37

Please sign in to comment.