Page Contents

Home > @loopback/authentication > AuthenticationBindings > CURRENT_USER

AuthenticationBindings.CURRENT_USER variable

Key used to inject the user instance retrieved by the authentication function

Signature:

CURRENT_USER: BindingKey<UserProfile | undefined>

Example

class MyController {
  constructor(
    @inject(AuthenticationBindings.CURRENT_USER) private user: UserProfile,
  ) {}

// ... routes that may need authentication

}