I have an Upwork API associated with my account, and I'm trying to use it for messaging purposes. I am following the API reference documentation. I have both the consumer and secret keys.
However, I'm encountering an issue that I am making a call to the callback endpoint to receive the auth_token necessary to proceed further, but I am not receiving it as expected.
Could someone please help me identify and resolve this issue?
main.py
from flask import Flask, request
import upwork
app = Flask(__name__)
config = upwork.Config({
"consumer_key": "xxxxxxx",
"consumer_secret": "xxxxxxx",
"redirect_uri": "https://localhost"
})
@app.route('/callback')
def callback():
# Get the authorization code from the request
auth_code = request.args.get('code')
client = upwork.Client(config)
token = client.get_authorization_url()
# print("Authorization URL:", token)
return f"Authorization URL:{token}"
if __name__ == '__main__':
app.run(host='localhost', port=5000)
calling the callback as:
test.py
import requests
response = requests.get("http://localhost:5000/callback")
getting this in return:
Authorization URL:https://www.upwork.com/services/api/auth?oauth_token=None
I am expecting it to return the auth_token so that I can proceed further with it.