Created
May 23, 2016 06:12
-
-
Save toughrogrammer/dde88d81ea36d1567c0df1d3a0435c37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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