Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get "app" instance in middleware #4586

Closed
foubei opened this issue Jan 22, 2021 · 1 comment
Closed

Get "app" instance in middleware #4586

foubei opened this issue Jan 22, 2021 · 1 comment

Comments

@foubei
Copy link

foubei commented Jan 22, 2021

What happens?

Unable to get the app instance in middlewares

Mini Showcase Repository(REQUIRED)

Provide a mini GitHub repository which can reproduce the issue.
Use npm init egg --type=simple bug then upload to your GitHub

How To Reproduce

Steps to reproduce the behavior:

  1. I am unable to put the authentication code inside middleware instead of controller. the app.passport is inaccessible in middleware.

Expected behavior

  1. Able to access app.passport directly from middleware and handle the authentication

Context

  • Node Version: 10.19.0
  • Egg Version: 2.15.1
  • Plugin Name: egg-passport
  • Plugin Version: 2.1.1
  • Platform: Ubuntu
@egg-bot
Copy link

egg-bot commented Jan 25, 2021

Hello @foubei. Please provide a reproducible example following the instruction.

Issues labeled by Need Reproduce will be closed if no activities in 7 days.


@foubei,请根据这个说明提供最小可复现代码。

如果在 7 天内没有进展会被自动关闭。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants