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);