Skip to content

Instantly share code, notes, and snippets.

@toughrogrammer
Created May 23, 2016 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toughrogrammer/dde88d81ea36d1567c0df1d3a0435c37 to your computer and use it in GitHub Desktop.
Save toughrogrammer/dde88d81ea36d1567c0df1d3a0435c37 to your computer and use it in GitHub Desktop.
@app.errorhandler(401)
def unauthorized(e):
# 토큰이 만료된 경우에는 일단 토큰 재발급을 시도해본다
if e.description == 'expired':
return refreshing_oauth_token()
elif e.description == 'permission_required':
return render_template('error/error.html',
data={
'title': '401!!',
'header': '권한이 없어요!',
'message': '필요한 권한을 갖고있지 않으십니다.'
}), 401
response = make_response(redirect(get_oauth_req_url()))
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment