Skip to content

Commit

Permalink
Merge pull request #56 from onaio/opensrp-provider-updates
Browse files Browse the repository at this point in the history
Check first if Custom-Api-Token headers is set.
  • Loading branch information
moshthepitt authored Sep 16, 2020
2 parents 26b183f + a5c2459 commit 4a965f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion superset_patchup/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ def oauth_authorized(self, provider):
"""View that a user is redirected to from the Oauth server"""

logging.debug("Authorized init")
resp = self.appbuilder.sm.oauth_remotes[provider].authorize_access_token()
if "Custom-Api-Token" in request.headers:
logging.debug("Custom-Api-Token is present")
resp = {"access_token": request.headers.get("Custom-Api-Token")}
else:
resp = self.appbuilder.sm.oauth_remotes[provider].authorize_access_token()
if resp is None:
flash("You denied the request to sign in.", "warning")
return redirect("/login")
Expand Down

0 comments on commit 4a965f0

Please sign in to comment.