Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
shihjay2 committed Aug 18, 2024
1 parent 74b0a09 commit 70aa2c0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -519,16 +519,17 @@ app.get('/oidc_relay_connect', async(req, res) => {
if (objectPath.has(req, 'query.proxystate')) {
const code_verifier = generators.codeVerifier()
const code_challenge = generators.codeChallenge(code_verifier)
let url = null
if (doc.type === 'epic') {
var url = client.authorizationUrl({
url = client.authorizationUrl({
scope: scope,
code_challenge,
state: req.query.proxystate,
aud: doc.fhir_url,
code_challenge_method: 'S256'
})
} else {
var url = client.authorizationUrl({
url = client.authorizationUrl({
scope: scope,
code_challenge,
state: req.query.proxystate,
Expand All @@ -539,20 +540,19 @@ app.get('/oidc_relay_connect', async(req, res) => {
await db.put(doc)
res.redirect(url)
} else {
console.log(doc)
const params = client.callbackParams(req)
console.log(params)
const check = {
code_verifier: doc.code_verifier,
state: req.query.state,
response_type: 'code'
}
try {
let tokenSet = null
if (doc.type === 'epic') {
var tokenSet = await client.callback(urlFix(process.env.DOMAIN) + 'oidc_relay_connect', params, check)
tokenSet = await client.callback(urlFix(process.env.DOMAIN) + 'oidc_relay_connect', params, check)
console.log('validated ID Token claims %j', tokenSet.claims())
} else {
var tokenSet = await client.oauthCallback(urlFix(process.env.DOMAIN) + 'oidc_relay_connect', params, check)
tokenSet = await client.oauthCallback(urlFix(process.env.DOMAIN) + 'oidc_relay_connect', params, check)
}
console.log('received and validated tokens %j', tokenSet)
objectPath.set(doc, 'access_token', tokenSet.access_token)
Expand Down

0 comments on commit 70aa2c0

Please sign in to comment.