Refresh Token via Management API got error "java.lang.Integer cannot be cast to java.lang.Long"

Not applicable

Hello,

I am following this link to get Access token and refresh token within 30 minutes:

https://docs.apigee.com/api-platform/system-administration/management-api-tokens

However I got following response from server when refresh token API call was made:

{"error":"server_error","error_description":"java.lang.Integer cannot be cast to java.lang.Long"}

Has anyone seen this before? Is this an issue on Apigee Management API side?

1 4 172
4 REPLIES 4

sidd-harth
Participant V

Hi @Jun Li, I have tried the same and it works for me.

Can you post your refresh token curl command here?

Mine is Python code,

it worked for me sometimes, but most of time it fails.

I run this every 25 minutes within 24 hrs. After 24 hrs, I have to get a new pair of access_token and refresh token.

url = "https://login.apigee.com/oauth/token"

headers = ast.literal_eval(urllib.parse.unquote("{'Content-Type':'application/x-www-form-urlencoded;charset=utf-8', 'Accept':'application/json;charset=utf-8', 'Authorization':'Basic ZWRnZWNsaTplZGdlY2xpc2VjcmV0'}"))

data = ast.literal_eval(urllib.parse.unquote("{'grant_type':'refresh_token', 'refresh_token':'" + refreshEdgeToken + "'}"))

res = requests.post(url, data, headers)

Honestly speaking I have no idea about Python. But a quick google search gave me this,

https://stackoverflow.com/questions/48705166/python-does-not-convert-long-to-int

I think the issue is with the refresh_token, please have a look.

I'm experiencing the same issue - any hint on how you solved it?