Bhoomikan opened a new issue #17311:
URL: https://github.com/apache/airflow/issues/17311


   **Apache Airflow version**: 2.0.0b3
      
      
      **Kubernetes version (if you are using kubernetes)** (use `kubectl 
version`): NA - LocalExecutor
      
      **Environment**:
      
      - **Cloud provider or hardware configuration**:  Local development on 
Internal IT Cloud Instance
      - **OS** (e.g. from /etc/os-release): Redhat-7
      - **Others**:  Python 3.6
      
      **What happened**:
      
      When trying to register with Google providers having 
`webserver_config.py` as written here:
      ```
      import os
      from flask_appbuilder.security.manager import AUTH_OAUTH
      AUTH_TYPE = AUTH_OAUTH
      AUTH_USER_REGISTRATION = True
      AUTH_USER_REGISTRATION_ROLE = "Admin"
      AUTH_USER_REGISTRATION_ROLE_JMESPATH = "contains(['GMAIL_ACCOUNT'], 
email) && 'Admin'
   || 'Public'"
      CSRF_ENABLED = True
      
      OAUTH_PROVIDERS = [
          {
              'name': 'google', 'icon': 'fa-google',
              'token_key': 'access_token',
              'whitelist': ['@CUSTOM_GMAIL.COM'],
              'remote_app': {
                  'client_id': 'GOOGLE KEY',
                  'client_secret': 'GOOGLE SECRET',
                  'api_base_url': 'https://www.googleapis.com/oauth2/v2/',
                  'client_kwargs': {
                      'scope': 'email profile'
                  },
                  'request_token_url': None,
                  'access_token_url': 
'https://accounts.google.com/o/oauth2/token',
                  'authorize_url': 'https://accounts.google.com/o/oauth2/auth'}
          }
      ]
      ```
      a `authlib.integrations.base_client.errors.MismatchingStateError: 
mismatching_state: CSRF
   Warning! State not equal in request and response.` error occurred:
      ```
      Something bad has happened.
   Please consider letting us know by creating a bug report using GitHub.
   
   Python version: 3.6.9
   Airflow version: 2.1.1
   Node: or1010051080212.corp.adobe.com
   
-------------------------------------------------------------------------------
   <details> 
   Traceback (most recent call last):
     File 
"/root/airflow_project/airflow-venv/lib64/python3.6/site-packages/flask/app.py",
 line 2447, in wsgi_app
       response = self.full_dispatch_request()
     File 
"/root/airflow_project/airflow-venv/lib64/python3.6/site-packages/flask/app.py",
 line 1952, in full_dispatch_request
       rv = self.handle_user_exception(e)
     File 
"/root/airflow_project/airflow-venv/lib64/python3.6/site-packages/flask/app.py",
 line 1821, in handle_user_exception
       reraise(exc_type, exc_value, tb)
     File 
"/root/airflow_project/airflow-venv/lib64/python3.6/site-packages/flask/_compat.py",
 line 39, in reraise
       raise value
     File 
"/root/airflow_project/airflow-venv/lib64/python3.6/site-packages/flask/app.py",
 line 1950, in full_dispatch_request
       rv = self.dispatch_request()
     File 
"/root/airflow_project/airflow-venv/lib64/python3.6/site-packages/flask/app.py",
 line 1936, in dispatch_request
       return self.view_functions[rule.endpoint](**req.view_args)
     File 
"/root/airflow_project/airflow-venv/lib64/python3.6/site-packages/flask_appbuilder/security/views.py",
 line 695, in oauth_authorized
       resp = 
self.appbuilder.sm.oauth_remotes[provider].authorize_access_token()
     File 
"/root/airflow_project/airflow-venv/lib64/python3.6/site-packages/authlib/integrations/flask_client/remote_app.py",
 line 74, in authorize_access_token
       params = self.retrieve_access_token_params(flask_req, request_token)
     File 
"/root/airflow_project/airflow-venv/lib64/python3.6/site-packages/authlib/integrations/base_client/base_app.py",
 line 145, in retrieve_access_token_params
       params = self._retrieve_oauth2_access_token_params(request, params)
     File 
"/root/airflow_project/airflow-venv/lib64/python3.6/site-packages/authlib/integrations/base_client/base_app.py",
 line 126, in _retrieve_oauth2_access_token_params
       raise MismatchingStateError()
   authlib.integrations.base_client.errors.MismatchingStateError: 
mismatching_state: CSRF Warning! State not equal in request and 
response.</details>
      ```
      
      **What you expected to happen**:
      
      It should me register and login


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to