Is there a way to allow my clients to view their Upstox portfolio within my application

I facing this error with a different user:
Something went wrong. Please try again after some time. [1017127]

My code:
from flask import Flask, redirect, request, jsonify
import requests

app = Flask(name)

CLIENT_ID = ‘CLIENT_ID’
CLIENT_SECRET = ‘CLIENT_SECRET’
REDIRECT_URI = ‘redirect’

AUTHORIZATION_URL = ‘https://api.upstox.com/v2/login/authorization/dialog
TOKEN_URL = ‘https://api.upstox.com/v2/login/authorization/token

@app.route(‘/’)
def index():
auth_url = f"{AUTHORIZATION_URL}?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}"
return redirect(auth_url)

@app.route(‘/v1/auth’)
def auth_callback():
auth_code = request.args.get(‘code’)
if not auth_code:
return jsonify({“error”: “Authorization code not found”}), 400

token_data = {
    'code': auth_code,
    'client_id': CLIENT_ID,
    'client_secret': CLIENT_SECRET,
    'redirect_uri': REDIRECT_URI,
    'grant_type': 'authorization_code'
}

response = requests.post(TOKEN_URL, data=token_data)
if response.status_code != 200:
    return jsonify({"error": "Failed to obtain access token", "details": response.json()}), 400

access_token = response.json().get('access_token')
if not access_token:
    return jsonify({"error": "Access token not found in response"}), 400

return jsonify({"access_token": access_token})

if name == ‘main’:
app.run(debug=True)

what should I do now to get my clients to import the upstox portfolio in my application?