nagasurendra commited on
Commit
e4e2d12
·
verified ·
1 Parent(s): 53279a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -77,6 +77,16 @@ def dashboard():
77
  return jsonify(user_info) # Display user info from Salesforce
78
  else:
79
  return jsonify({"error": "Failed to fetch user info from Salesforce"}), 400
 
 
 
 
 
 
 
 
 
 
80
 
81
  if __name__ == '__main__':
82
  app.run(debug=True)
 
77
  return jsonify(user_info) # Display user info from Salesforce
78
  else:
79
  return jsonify({"error": "Failed to fetch user info from Salesforce"}), 400
80
+ if token_response.status_code == 200:
81
+ token_info = token_response.json()
82
+ access_token = token_info['access_token'] # Correctly fetch the access token
83
+ instance_url = token_info['instance_url'] # Correctly fetch the instance URL
84
+
85
+ # Store access token in session for future API requests
86
+ session['access_token'] = access_token
87
+ session['instance_url'] = instance_url
88
+
89
+ return redirect('/dashboard') # Redirect user to the Hugging Face dashboard or home page
90
 
91
  if __name__ == '__main__':
92
  app.run(debug=True)