Auto-Login to Piwik

(_nk) #1


i use 3 Piwik installations on different servers for about 40 domains. Because it took so much time to switch between all the domains and installations to view the stats, i made one html-page with iframes of the current stats from all 40 domains.

So i can save a lot of time. Thanks a lot for the tool guys!

But theres one thing which i want to improve: I have to log in at each of the 3 installations first, before i can see my stats on the page with the iframes. I dont want to make the stats available for anonymous users - so i have to log in first - then i can see the stats on my page with the iframes.

I thought it must be possible to do some kind of auto-login. My way would be to put the login-urls of the 3 installations into 3 small iframes, which load the login-url including name and pw and put them on the page with all the iframes too.

I tried to get the url which is sent for the login with Firebug - but something seems missing, when i open this url, i dont login - i just get the login-form again.

Thats the url i tried:

Can you tell me where i am wrong - or another way to get some kind of auto-login for my stats-page with all the iframes?


(michaelc) #2

Hi _nk,

Instead of using GET with the provided URL I would try using POST somehow automated with the javascript in your iFrames subpages.

Generally, Piwik login screen POSTs variables using the following form:

<form  action="http://localhost:83/piwik_0_2_26/" method="post" name="loginform" id="loginform">
<label>Username:<br />
<input type="text" name="form_login" id="form_login" class="input" value="" size="20" tabindex="10" /></label>
<label>Password:<br />
<input type="password" name="form_password" id="form_password" class="input" value="" size="20" tabindex="20" /></label>
<input name="form_url" type="hidden" value="http://localhost:83/piwik_0_2_26/" />
<p class="submit">
<input type="submit" value="Sign in" tabindex="100" />


You could try to grab the above variables together with form name and try to POST it (automatically) using javascript code.

I hope I’m right style_emoticons/<#EMO_DIR#>/smile.gif

(_nk) #3

Hi michaelc, thanks for your help.

Can you give me an example of how to do a post by javascript? I have no experience in this field. Especially because i have to post the data to three different urls, how can i accomplish that?


Free Pictures & Images for Webmasters:
English: Pictures [/url]| French: Images | German: [url=]Bilder

(robocoder) #4

There’s a proposed patch in Trac, ticket 514 (HTTP_AUTH login forwarded to Piwik) that might serve your needs.

(_nk) #5

hi robocoder,

thanks for your reply. i installed the patch as a plugin and activated it - but i get a error-message:

Fatal error: Call to undefined method Piwik_HttpAuthLogin_Auth::setLogin() in /usr/www/users/xyz/piwik/plugins/Login/Controller.php on line 76

There is no setLogin() in the HTTPAuth Plugin - can you tell me what to do?

[size=8pt]Free resources for webmasters:
Netherlands: Afbeeldingen [/url]| Croatia: Slike | Czech: [url=]Obrazky[/size]

(robocoder) #6

Hmm… sounds like the submitted patch is incomplete. Back it out for now. There’s some auth refactoring on the way (to support Zend OpenID).