title: Not able to track current user in flask-login in Stripe Webhook
body: <p>I am trying to track the current customer and linking the webhook details to the email id of the user.</p>
  <p>models.py</p>
  <pre><code>from flask_login import UserMixin
  from . import db
  
  class User(UserMixin, db.Model):
      id = db.Column(db.Integer, primary_key=True) # primary keys are required by SQLAlchemy
      #admin=db.Column
      public_id=db.Column(db.String(50), unique=True)
      email = db.Column(db.String(100), unique=True)
      password = db.Column(db.String(100))
      name = db.Column(db.String(1000))
  </code></pre>
  <p>main.py</p>
  <pre><code>@main.route(&quot;/webhook&quot;, methods=[&quot;POST&quot;])
  def webhooks():
      payload = request.get_data(as_text=True)
      
      sig_header = request.headers.get(&quot;Stripe-Signature&quot;,None)
      
      
  
      try:
          event = stripe.Webhook.construct_event(
              payload,
              sig_header, stripe_keys[&quot;endpoint_secret&quot;]
          )
  
      except ValueError as e:
          # Invalid payload
          print(&quot;Invalid payload&quot;)
          return &quot;Invalid payload&quot;, 400
      except stripe.error.SignatureVerificationError as e:
          return &quot;Invalid signature&quot;, 400
  
      if current_user.is_authenticated:
                   email=current_user.email
      else:
                    print(&quot;Not authenticated!&quot;)
  </code></pre>
  <p>And it keeps printing &quot;Not authenticated!&quot; In case i use @login_required for webhook endpoint, i keep getting 302 error.</p>
  <p>Please enlighten me on where i am going wrong</p>