Please take a look at the very latest Structured Data Sniffer Extension. It includes an improved login feature that you should be able to reuse.
You can also look at our HTML5-based Single Page Application which also reuses the same Solid Authentication Client library.