mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
uberf-7350: add more oauth logs (#5879)
This commit is contained in:
parent
182d108b87
commit
adb286676e
@ -38,7 +38,7 @@ export function registerGithub (
|
|||||||
router.get('/auth/github', async (ctx, next) => {
|
router.get('/auth/github', async (ctx, next) => {
|
||||||
measureCtx.info('try auth via', { provider: 'github' })
|
measureCtx.info('try auth via', { provider: 'github' })
|
||||||
const host = getHost(ctx.request.headers)
|
const host = getHost(ctx.request.headers)
|
||||||
const branding = host !== undefined ? brandings[host]?.key ?? '' : ''
|
const branding = host !== undefined ? brandings[host]?.key ?? undefined : undefined
|
||||||
const state = encodeURIComponent(
|
const state = encodeURIComponent(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
inviteId: ctx.query?.inviteId,
|
inviteId: ctx.query?.inviteId,
|
||||||
|
@ -38,7 +38,7 @@ export function registerGoogle (
|
|||||||
router.get('/auth/google', async (ctx, next) => {
|
router.get('/auth/google', async (ctx, next) => {
|
||||||
measureCtx.info('try auth via', { provider: 'google' })
|
measureCtx.info('try auth via', { provider: 'google' })
|
||||||
const host = getHost(ctx.request.headers)
|
const host = getHost(ctx.request.headers)
|
||||||
const branding = host !== undefined ? brandings[host]?.key ?? '' : ''
|
const branding = host !== undefined ? brandings[host]?.key ?? undefined : undefined
|
||||||
const state = encodeURIComponent(
|
const state = encodeURIComponent(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
inviteId: ctx.query?.inviteId,
|
inviteId: ctx.query?.inviteId,
|
||||||
@ -53,14 +53,19 @@ export function registerGoogle (
|
|||||||
redirectURL,
|
redirectURL,
|
||||||
async (ctx, next) => {
|
async (ctx, next) => {
|
||||||
const state = safeParseAuthState(ctx.query?.state)
|
const state = safeParseAuthState(ctx.query?.state)
|
||||||
|
measureCtx.info('Auth state', { state })
|
||||||
const branding = getBranding(brandings, state?.branding)
|
const branding = getBranding(brandings, state?.branding)
|
||||||
|
measureCtx.info('With branding', { branding })
|
||||||
|
const failureRedirect = concatLink(branding?.front ?? frontUrl, '/login')
|
||||||
|
measureCtx.info('With failure redirect', { failureRedirect })
|
||||||
|
|
||||||
passport.authenticate('google', {
|
passport.authenticate('google', {
|
||||||
failureRedirect: concatLink(branding?.front ?? frontUrl, '/login'),
|
failureRedirect,
|
||||||
session: true
|
session: true
|
||||||
})(ctx, next)
|
})(ctx, next)
|
||||||
},
|
},
|
||||||
async (ctx, next) => {
|
async (ctx, next) => {
|
||||||
|
measureCtx.info('Provider auth success', { type: 'google', user: ctx.state?.user })
|
||||||
const email = ctx.state.user.emails?.[0]?.value
|
const email = ctx.state.user.emails?.[0]?.value
|
||||||
const first = ctx.state.user.name.givenName
|
const first = ctx.state.user.name.givenName
|
||||||
const last = ctx.state.user.name.familyName
|
const last = ctx.state.user.name.familyName
|
||||||
|
Loading…
Reference in New Issue
Block a user