Skip to content

Commit

Permalink
Better Oauth support
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Dec 28, 2018
1 parent 9daa2fb commit 6b94609
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/examples/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,19 @@ def me(self):
user = api.self_user()
return user

@appier.route("/logout", "GET")
def logout(self):
return self.oauth_error(None)

@appier.route("/oauth", "GET")
def oauth(self):
code = self.field("code")
error = self.field("error")
appier.verify(
not error,
message = "Invalid OAuth response (%s)" % error,
exception = appier.OperationalError
)
api = self.get_api()
access_token = api.oauth_access(code)
self.session["live.access_token"] = access_token
Expand Down

0 comments on commit 6b94609

Please sign in to comment.