Re: Invalid assertion structure

52 views
Skip to first unread message

Sunny Lee

unread,
Mar 21, 2013, 9:19:37 AM3/21/13
to Alex Britez, openbad...@googlegroups.com
Great, thanks!

If you want help real time, join us in our irc channel, irc.mozilla.org, #badges. You can ping any of us, threeqube (that's me), brianloveswords, mlarsson, emgollie, cmcavoy. 




On Thu, Mar 21, 2013 at 7:50 AM, Alex Britez <abr...@gmail.com> wrote:
Re-looked at this after some sleep and noticed that i had a typo on criteria.  Working fine now.




On Thursday, March 21, 2013 1:43:57 AM UTC-4, Alex Britez wrote:
I am trying to get a proof of concept working on my site, so i could build on, but keep getting an error. Hoping someone could point me in the right direction.

I am getting 2 404s

with an error of:
{"message":"Invalid assertion structure","stack":"Error: Invalid assertion structure\n at makeError (/var/www/openbadges/node_modules/openbadges-validator/index.js:385:15)\n at fullValidateOldAssertion (/var/www/openbadges/node_modules/openbadges-validator/index.js:299:21)\n at validate (/var/www/openbadges/node_modules/openbadges-validator/index.js:249:14)\n at /var/www/openbadges/lib/analyze-assertion.js:52:14\n at Request._callback (/var/www/openbadges/lib/analyze-assertion.js:35:12)\n at Request.callback (/var/www/openbadges/node_modules/request/main.js:120:22)\n at Request.emit (events.js:70:17)\n at Request.<anonymous> (/var/www/openbadges/node_modules/request/main.js:555:16)\n at Request.emit (events.js:67:17)\n at IncomingMessage.<anonymous> (/var/www/openbadges/node_modules/request/main.js:517:14)","code":"structure","extra":{"badge.criteria":{"message":"must be a URL","stack":"Error: must be a URL\n at makeError (/var/www/openbadges/node_modules/openbadges-validator/index.js:385:15)\n at required (/var/www/openbadges/node_modules/openbadges-validator/index.js:539:23)\n at validateOldAssertion (/var/www/openbadges/node_modules/openbadges-validator/index.js:123:3)\n at validateAssertion (/var/www/openbadges/node_modules/openbadges-validator/index.js:22:12)\n at fullValidateOldAssertion (/var/www/openbadges/node_modules/openbadges-validator/index.js:297:28)\n at validate (/var/www/openbadges/node_modules/openbadges-validator/index.js:249:14)\n at /var/www/openbadges/lib/analyze-assertion.js:52:14\n at Request._callback (/var/www/openbadges/lib/analyze-assertion.js:35:12)\n at Request.callback (/var/www/openbadges/node_modules/request/main.js:120:22)\n at Request.emit (events.js:70:17)"}}}


It says "badge.criteria":{"message":"must be a URL", but i have this set to http://dev.makersquest.com, so not sure what i am doing wrong.

SAMPLE PHP
<?php

    function hashEmailAddress($email, $salt) {
        return 'sha256$' . hash('sha256', $email . $salt);
    }

    $obObj = new stdClass;
    $obObj->recipient = hashEmailAddress("name@example.com", "makeit");
    $obObj->salt = "makeit";
    $obObj->evidence = "http://dev.makersquest.com";
    $obObj->expires = "2013-06-01";
    $obObj->issued_on = "2011-06-01";
    $obObj->badge = new stdClass;
    $obObj->badge->version = "0.5.0";
    $obObj->badge->name = "Noobie2";
    $obObj->badge->image = "http://dev.makersquest.com/badges/noob.png";
    $obObj->badge->description = "This is a badge for the maker noobie";
    $obObj->badge->critieria = "http://dev.makersquest.com";
    $obObj->badge->issuer = new stdClass;
    $obObj->badge->issuer->origin = "http://dev.makersquest.com";
    $obObj->badge->issuer->name = "MakersQuest.com";
    $obObj->badge->issuer->org = "MakersQuest";
    $obObj->badge->issuer->contact = "bad...@example.com";
    
    header('Content-Type: application/json');
    echo json_encode($obObj);

?>


JSON

{"recipient":"sha256$4296397c85f869f52ef119ff886196f4cb815d331fa02d5f7067ddaef9067416","salt":"makeit","evidence":"http:\/\/dev.makersquest.com\/","expires":"2013-06-01","issued_on":"2011-06-01","badge":{"version":"0.5.0","name":"Noobie","image":"http:\/\/dev.makersquest.com\/badges\/noob.png","description":"This is a badge for the maker noob","critieria":"http:\/\/dev.makersquest.com\/","issuer":{"origin":"http:\/\/dev.makersquest.com","name":"MakersQuest.com","org":"MakersQuest","contact":"badges@example.com"}}}


Thanks for any help,

Alex B.

--
You received this message because you are subscribed to the Google Groups "Mozilla Open Badges Dev Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openbadges-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages