diff --git a/auth/scopes.py b/auth/scopes.py
index 30d88169d..fea8b8884 100644
--- a/auth/scopes.py
+++ b/auth/scopes.py
@@ -54,11 +54,12 @@ def get_scope_information(scopes_string):
   scopes = scopes_from_scope_string(scopes_string)
   scope_info = []
   for scope in scopes:
-    scope_info.append({
-      'title': ALL_SCOPES[scope]['title'],
-      'scope': ALL_SCOPES[scope]['scope'],
-      'description': ALL_SCOPES[scope]['description'],
-      'icon': ALL_SCOPES[scope]['icon'],
-    })
+    if scope:
+      scope_info.append({
+          'title': ALL_SCOPES[scope]['title'],
+          'scope': ALL_SCOPES[scope]['scope'],
+          'description': ALL_SCOPES[scope]['description'],
+          'icon': ALL_SCOPES[scope]['icon'],
+          })
 
   return scope_info
diff --git a/endpoints/web.py b/endpoints/web.py
index 5ead821da..f7c3ec009 100644
--- a/endpoints/web.py
+++ b/endpoints/web.py
@@ -278,6 +278,9 @@ def request_authorization_code():
 
     # Load the scope information.
     scope_info = scopes.get_scope_information(scope)
+    if not scope_info:
+      abort(404)
+      return
 
     # Load the application information.
     oauth_app = provider.get_application_for_client_id(client_id)