From aa28f00a4bb1e91f0a19e9e3147d91c7ccb8e1d1 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 6 Dec 2017 07:46:25 +0000 Subject: [PATCH] let validated 3rd party tokens pass --- lib/oauth3.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/oauth3.js b/lib/oauth3.js index c74b2e8..ff0cd27 100644 --- a/lib/oauth3.js +++ b/lib/oauth3.js @@ -35,11 +35,14 @@ function generateRescope(req, Models, decoded, fullPpid, ppid) { console.log('[DEBUG] fullPpid:', fullPpid); console.log('[DEBUG] ppid:', ppid); - throw new Error( - "TODO: No profile found with that credential. Would you like to create a new profile or link to an existing profile?" - ); - } + if (!req.oauth3.token.sub || !req.oauth3.token.iss) { + throw new Error( + "TODO: No profile found with that credential. Would you like to create a new profile or link to an existing profile?" + ); + } + return req.oauth3.token.sub + '@' + req.oauth3.token.iss; + } // XXX BUG XXX need to pass own url in to use as issuer for own tokens req.oauth3.accountIdx = result.sub + '@' + (result.iss || decoded.iss);