Yaswanth56 commited on
Commit
6c4be79
·
verified ·
1 Parent(s): 4ff8cd5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -22,8 +22,17 @@ SALESFORCE_OAUTH_URL = "https://login.salesforce.com/services/oauth2/authorize"
22
  SALESFORCE_TOKEN_URL = "https://login.salesforce.com/services/oauth2/token"
23
  CLIENT_ID = os.getenv('SALESFORCE_CLIENT_ID', 'your_client_id') # Use environment variables
24
  CLIENT_SECRET = os.getenv('SALESFORCE_CLIENT_SECRET', 'your_client_secret') # Use environment variables
25
- REDIRECT_URI = os.getenv('SALESFORCE_REDIRECT_URI', 'https://huggingface.co/spaces/Yaswanth56/python_test')
26
 
 
 
 
 
 
 
 
 
 
27
 
28
  # Salesforce connection setup
29
  def get_salesforce_connection():
 
22
  SALESFORCE_TOKEN_URL = "https://login.salesforce.com/services/oauth2/token"
23
  CLIENT_ID = os.getenv('SALESFORCE_CLIENT_ID', 'your_client_id') # Use environment variables
24
  CLIENT_SECRET = os.getenv('SALESFORCE_CLIENT_SECRET', 'your_client_secret') # Use environment variables
25
+ REDIRECT_URI = os.getenv('SALESFORCE_REDIRECT_URI', 'https://huggingface.co/spaces/Yaswanth56/python_test/oauth/callback')
26
 
27
+ @app.route('/oauth/callback')
28
+ def oauth_callback():
29
+ auth_code = request.args.get('code') # The code returned from Salesforce
30
+
31
+ if not auth_code:
32
+ return jsonify({"error": "No authorization code provided"}), 400
33
+
34
+ # Your OAuth logic to handle the authorization code
35
+ return jsonify({"success": "OAuth callback is working!"})
36
 
37
  # Salesforce connection setup
38
  def get_salesforce_connection():