summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_httpd_oauth.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/couchdb/couch_httpd_oauth.erl')
-rw-r--r--src/couchdb/couch_httpd_oauth.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/couchdb/couch_httpd_oauth.erl b/src/couchdb/couch_httpd_oauth.erl
index 7160d8ce..e46ea5bc 100644
--- a/src/couchdb/couch_httpd_oauth.erl
+++ b/src/couchdb/couch_httpd_oauth.erl
@@ -38,7 +38,10 @@ oauth_authentication_handler(#httpd{mochi_req=MochiReq}=Req) ->
set_user_ctx(Req, AccessToken) ->
DbName = couch_config:get("couch_httpd_auth", "authentication_db"),
{ok, _Db} = couch_httpd_auth:ensure_users_db_exists(?l2b(DbName)),
- Name = ?l2b(couch_config:get("oauth_token_users", AccessToken)),
+ Name = case couch_config:get("oauth_token_users", AccessToken) of
+ undefined -> throw({bad_request, unknown_oauth_token});
+ Value -> ?l2b(Value)
+ end,
case couch_httpd_auth:get_user(Name) of
nil -> Req;
User ->