persona giving no popup

56 views Asked by At

I tried to implement persona in my site but i don't get it to work.

<body>

<a href="" class="login">login</a>
    <script src="https://login.persona.org/include.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script>
    $(function() {
    $('#login').click(function(e){ navigator.id.request(); });
    $('#logout').click(function(e){ navigator.id.logout(); });
    navigator.id.watch({
        loggedInUser: null,
        onlogin: function(assertion) {
            $.post(
                '/auth.php',
                {assertion:assertion},
                function(msg) { console.log('login success!') }
            );
        },
        onlogout: function() {
            $.post(
                '/auth.php',
                {logout:1},
                function(msg) { console.log('logout success!') }
            );
        }
    });
});


    </script>
</body>

Here is a fiddle: http://jsfiddle.net/cMeUp/ but i don't even get a popup.

Do you guys know anything thats wrong with it?

Greetings

1

There are 1 answers

1
rockStar On BEST ANSWER

in your code your using login as a class not as an id

your code:

<a href="" class="login">login</a>
$('#login').click(function(e){ navigator.id.request(); });

try:

<a href="" id="login">login</a>

as you are using $('#login') as a selector.

here's a working JSFiddle