提交 3f91e93b 编写于 作者: M Mislav Marohnić

Match fake API server to what GitHub API returns for 2FA

* it's `required; app` instead of `required;application`
* there is a JSON error message in the 401 response
上级 2c6e0bc7
......@@ -136,11 +136,13 @@ Feature: OAuth authentication
"""
post('/authorizations') {
assert_basic_auth 'mislav', 'kitty'
if request.env['HTTP_X_GITHUB_OTP'] != "112233"
response.headers['X-GitHub-OTP'] = "required;application"
halt 401
if request.env['HTTP_X_GITHUB_OTP'] == '112233'
json :token => 'OTOKEN'
else
response.headers['X-GitHub-OTP'] = 'required; app'
status 401
json :message => "Must specify two-factor authentication OTP code."
end
json :token => 'OTOKEN'
}
get('/user') {
json :login => 'mislav'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册