MCPcopy
hub / github.com/simov/grant / app

Function app

lib/handler/azure.js:21–42  ·  view source on GitHub ↗
(req, state)

Source from the content-addressed store, hash-verified

19 var store = Session(args.session)
20
21 async function app (req, state) {
22 var session = store(req)
23 var match = regex.exec(req.originalUrl)
24 if (!match) {
25 return {session}
26 }
27
28 var {location, session:sess, state} = await grant({
29 method: req.method,
30 params: {provider: match[1], override: match[2]},
31 query: {...req.query, code: req.query.oauth_code},
32 body: req.method === 'POST' ? req.body : {},
33 state,
34 session: (await session.get()).grant
35 })
36
37 await session.set({grant: sess})
38
39 return location
40 ? {session, redirect: redirect(location, session)}
41 : {session, response: state.response || sess.response}
42 }
43
44 return app
45}

Callers

nothing calls this directly

Calls 2

grantFunction · 0.85
redirectFunction · 0.70

Tested by

no test coverage detected