openId id_token validation in javascript (an angular service)

{"@id":"cedric-dumont.com"}

This post is related to the following stackoverflow question :
How can I validate an openId id_token in javascript.

The Short story

we need to use JSWS.

  1. download the libraries from here. I’ve downloaded version 3.0.2.
  2. in your index.html,reference the jws-3.0.js, the json-sans-eval.js file that you downloaded above
    (json-sans-eval is located in [jsjws-3.0.2ext] directory. (more info on it can be found here
    json-sans-eval site)
  3. if you run the code, you will get the following exception : b64utohex is not defined

  4. you need to reference another library. in fact I found the related project jsrsasign having the required libraries.
    you can download a release here : https://github.com/kjur/jsrsasign/tags/
    I downloaded the version 4.7.0 and took out the jsrsasign-4.7.0-all-min.js file and added in referencing scripts.

Now you have all the necessary files to get it done using the following code :

 function validateToken(id_token, cert) { var…

View original post 276 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s