title: Can I save OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE, REDIRECT_URI) to a session variable in flask?
body: <p>Im building a flask app that connects to Google Search Console API.</p>
  
  <p>I would like to save OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE, REDIRECT_URI) to a session variable so i can refer to it in a different flask route, where the user will submit the auth code and complete the authorisation process.</p>
  
  <p>I have tried the following code:</p>
  
  <pre><code>...
              flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE, REDIRECT_URI)
              authorize_url = flow.step1_get_authorize_url()
              webbrowser.open(authorize_url,new=1,autoraise=True)        
              response_text = { "message":  fulfillment_text }
              Session['flow'] = flow
              return jsonify(response_text)
  </code></pre>
  
  <p>However, Im getting the following error:</p>
  
  <p>Session['flow'] = flow
  TypeError: 'type' object does not support item assignment</p>
  
  <p>Is there a way round this?</p>
  
  <p>Many thanks in advance.</p>