Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Http Auth in a Firefox 3 bookmarklet

I'm trying to create a bookmarklet for posting del.icio.us bookmarks to a separate account.

I tested it from the command line like:

wget -O - --no-check-certificate \
"https://seconduser:[email protected]/v1/posts/add?url=http://seet.dk&description=test"

This works great.

I then wanted to create a bookmarklet in my firefox. I googled and found bits and pieces and ended up with:

javascript:void(
    open('https://seconduser:[email protected]/v1/posts/add?url='
          +encodeURIComponent(location.href)
          +'&description='+encodeURIComponent(document.title),
          'delicious','toolbar=no,width=500,height=250'
        )
    );

But all that happens is that I get this from del.icio.us:

<?xml version="1.0" standalone="yes"?>
<result code="access denied" />
<!-- fe04.api.del.ac4.yahoo.net uncompressed/chunked Thu Aug  7 02:02:54 PDT 2008 -->  

If I then go to the address bar and press enter, it changes to:

<?xml version='1.0' standalone='yes'?>
<result code="done" />
<!-- fe02.api.del.ac4.yahoo.net uncompressed/chunked Thu Aug  7 02:07:45 PDT 2008 -->

Any ideas how to get it to work directly from the bookmarks?

like image 301
svrist Avatar asked Aug 07 '08 09:08

svrist


People also ask

How do I use bookmarklet URL?

This can be inconvenient, so it's common to link bookmarklets when sharing. This is as simple as putting it in the href attribute of your link anchor. Now users can right-click and "Bookmark Link", or drag it to the bookmarks bar for easy access. Clicking the link on the web page will execute the script immediately.

How do I bookmark a bookmarklet?

Install Bookmarklet In most browsers, you can add the bookmarklet to your favorites by dragging it to the toolbar/bookmark bar. Internet Explorer users: right-click the button and Add to favorites.

How does a bookmarklet work?

A bookmarklet is a bookmark stored in a web browser that contains JavaScript commands that add new features to the browser. They are stored as the URL of a bookmark in a web browser or as a hyperlink on a web page. Bookmarklets are usually small snippets of JavaScript executed when user clicks on them.


2 Answers

Can you sniff the traffic to find what's actually being sent? Is it sending any auth data at all and it's incorrect or being presented in a form the server doesn't like, or is it never being sent by firefox at all?

like image 81
jj33 Avatar answered Oct 07 '22 02:10

jj33


@travis Looks very nice! I will sure take a look into it. I can think of several places I can use that

I never got round to sniff the traffic but found out that a php site on my own server with http-auth worked fine, so i figured it was something with delicious. I then created a php page that does a wget of the delicious api and everything works fine :)

like image 21
svrist Avatar answered Oct 07 '22 02:10

svrist