iriscouch / browserid_couchdb

Mozilla BrowserID support plugin for CouchDB
Apache License 2.0
57 stars 9 forks source link

Logout on _browserid fails #15

Closed ssured closed 11 years ago

ssured commented 11 years ago

When I do a logout to _browserid I get a crash:

=CRASH REPORT==== 1-Feb-2013::16:46:33 ===
  crasher:
    initial call: mochiweb_acceptor:init/3
    pid: <0.137.0>
    registered_name: []
    exception error: no match of right hand side value not_implemented
      in function  couch_httpd:handle_request_int/5 (/home/build-couchdb/dependencies/couchdb/src/couchdb/couch_httpd.erl, line 313)
      in call from mochiweb_http:headers/5 (/home/build-couchdb/dependencies/couchdb/src/mochiweb/mochiweb_http.erl, line 136)
    ancestors: [couch_httpd,couch_secondary_services,couch_server_sup,
                  <0.32.0>]
    messages: []
    links: [<0.125.0>,<0.332.0>,#Port<0.3144>]
    dictionary: [{mochiweb_request_body,<<>>},
                  {mochiweb_request_cookie,
                      [{"AuthSession",
                        "c2pvZXJkQHdlZXR0Lm5sOjUxMEJFMzRGOo_no1gJRlp_dVC37epNJxPMkXFZ"}]}]
    trap_exit: false
    status: running
    heap_size: 6765
    stack_size: 24
    reductions: 4046
  neighbours:
    neighbour: [{pid,<0.332.0>},
                  {registered_name,[]},
                  {initial_call,{ibrowse_http_client,init,['Argument__1']}},
                  {current_function,{gen,do_call,4}},
                  {ancestors,
                      [<0.137.0>,couch_httpd,couch_secondary_services,
                       couch_server_sup,<0.32.0>]},
                  {messages,[]},
                  {links,[<0.137.0>]},
                  {dictionary,
                      [{my_trace_flag,false},
                       {ibrowse_trace_token,
                           ["verifier.login.persona.org",58,"443"]},
                       {http_prot_vsn,"HTTP/1.1"},
                       {conn_close,"close"}]},
                  {trap_exit,false},
                  {status,waiting},
                  {heap_size,2584},
                  {stack_size,26},
                  {reductions,2286}]

This is running a master of 2 days ago, compiled using iriscouch build-couchdb with both browserid and geocouch plugins included.

The code I run is from the persona.org website https://developer.mozilla.org/en-US/docs/Persona/Quick_Setup

var currentUser = null;

navigator.id.watch({
  loggedInUser: currentUser,
  onlogin: function(assertion) {
    // A user has logged in! Here you need to:
    // 1. Send the assertion to your backend for verification and to create a session.
    // 2. Update your UI.
    $.ajax({ /* <-- This example uses jQuery, but you can use whatever you'd like */
      type: 'POST',
      url: '/_browserid', // This is a URL on your website.
      data: {assertion: assertion, audience: window.location.origin},
      success: function(res, status, xhr) { console.log("Login succeeded!", res, status, xhr); },
      error: function(xhr, status, err) { console.log("Login failure: " + err); }
    });
  },
  onlogout: function() {
    // A user has logged out! Here you need to:
    // Tear down the user's session by redirecting the user or making a call to your backend.
    // Also, make sure loggedInUser will get set to null on the next page load.
    // (That's a literal JavaScript null. Not false, 0, or undefined. null.)
    $.ajax({
      type: 'POST',
      url: '/_browserid', // This is a URL on your website.
      data: {},
      success: function(res, status, xhr) { console.log("Logout succeeded!", res, status, xhr); },
      error: function(xhr, status, err) { console.log("Logout failure: " + err); }
    });
  }
});

Login works as advertised. Am I doing something wrong or is this a bug?

ssured commented 11 years ago

Today I have built couchdb 1.3 including browserid_couchdb. Works now. No idea what caused this regression, will close.