static async signInErrorHandler()

in resources/oidc-provider/account/index.js [11:33]


  static async signInErrorHandler(ctx, next) {
    Log.debug('signinerrorhandler from oidc/account just got invoked!')
    try {
      await next()
    } catch (error) {
      const redirectUrl = url.parse(ctx.oidc.urlFor('interaction', { grant: ctx.oidc.uuid })).pathname

      switch (error.code) {
        case 'NotAuthorizedException':
        case 'UserNotFoundException':
          // Even if the user does not exist, return NotAuthorizedException.
          ctx.redirect(`${redirectUrl}?error=NotAuthorizedException`)
          break
        case 'PasswordResetRequiredException':
        case 'UserNotConfirmedException':
          ctx.redirect(`${redirectUrl}?error=${error.code}`)
          break
        default:
          ctx.throw(500, 'server_error', { error_description: error.message })
          break
      }
    }
  }