Skip to content

Commit

Permalink
use the access token kid to pick up the signing key (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbshetty authored Oct 8, 2020
1 parent c0941d5 commit 5eba0d3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions authn/pkce.index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,14 @@ function mainProcess(event, context, callback) {
.then(function(response) {
console.log(response);
const decodedData = jwt.decode(response.data.id_token, {complete: true});
console.log(decodedData);
const decodedAccessTokenData = jwt.decode(response.data.access_token, {complete: true});
console.log("Decoded id_token: ", decodedData);
console.log("Decoded access_token", decodedAccessTokenData);
try {
console.log("Searching for JWK from discovery document");

// Search for correct JWK from discovery document and create PEM
var pem = createPEM(decodedData.header.kid);
var pem = createPEM(decodedAccessTokenData.header.kid); //We are verifying the access token

console.log("Verifying JWT");
const access_token = response.data.access_token;
Expand Down

0 comments on commit 5eba0d3

Please sign in to comment.