B b4auser1 Well-Known Member Licensed User Longtime User Jun 19, 2015 #1 I tried to get JSON error text using Job.GetString If Job.Success = False Then Dim ErrorText As String = Job.GetString but some errors b4a raises exception about misssing cache file for others returns text, but not with error data. I can still see in the log error text like below. As far I understand the text is logged by internal proc inside Httputils2 framework. { "error" : "invalid_grant", "error_description" : "Code was already redeemed." } How to correct the problem ?
I tried to get JSON error text using Job.GetString If Job.Success = False Then Dim ErrorText As String = Job.GetString but some errors b4a raises exception about misssing cache file for others returns text, but not with error data. I can still see in the log error text like below. As far I understand the text is logged by internal proc inside Httputils2 framework. { "error" : "invalid_grant", "error_description" : "Code was already redeemed." } How to correct the problem ?
DonManfred Expert Licensed User Longtime User Jun 19, 2015 #2 b4auser1 said: { "error" : "invalid_grant", "error_description" : "Code was already redeemed." } Click to expand... Are you reusing the AUTH-code? Or did you get a fresh auth code before sending the request. looks like an auth-code can only be used once. For future requests you need to get a new one i believe. Upvote 0
b4auser1 said: { "error" : "invalid_grant", "error_description" : "Code was already redeemed." } Click to expand... Are you reusing the AUTH-code? Or did you get a fresh auth code before sending the request. looks like an auth-code can only be used once. For future requests you need to get a new one i believe.
B b4auser1 Well-Known Member Licensed User Longtime User Jun 19, 2015 #3 DonManfred said: Are you reusing the AUTH-code? Or did you get a fresh auth code before sending the request. looks like an auth-code can only be used once. For future requests you need to get a new one i believe. Click to expand... Thank you for fast response. I don't have a problem to get correct access token. But I want to process situations, if an error is returned. In order to process exceptions, I need to get data describing the error. Rest API returns the data as a JSON object. Now I can't get this JSON object - details in my previous message. Upvote 0
DonManfred said: Are you reusing the AUTH-code? Or did you get a fresh auth code before sending the request. looks like an auth-code can only be used once. For future requests you need to get a new one i believe. Click to expand... Thank you for fast response. I don't have a problem to get correct access token. But I want to process situations, if an error is returned. In order to process exceptions, I need to get data describing the error. Rest API returns the data as a JSON object. Now I can't get this JSON object - details in my previous message.
DonManfred Expert Licensed User Longtime User Jun 19, 2015 #4 Code: Copy Dim parser As JSONParser parser.Initialize(your json string here) Dim root As Map = parser.NextObject Dim error As String = root.Get("error") Dim error_description As String = root.Get("error_description") Upvote 0
Code: Copy Dim parser As JSONParser parser.Initialize(your json string here) Dim root As Map = parser.NextObject Dim error As String = root.Get("error") Dim error_description As String = root.Get("error_description")
B b4auser1 Well-Known Member Licensed User Longtime User Jun 19, 2015 #5 DonManfred said: Code: Copy Dim parser As JSONParser parser.Initialize(your json string here) Dim root As Map = parser.NextObject Dim error As String = root.Get("error") Dim error_description As String = root.Get("error_description") Click to expand... Httputils2 framework works incorrectly and Job.GetString doesn't return correct text with JSON data. For some errors, b4a raises exception about misssing cache file, for others it returns text, but not with correct JSON error data. It's necessary to fix something to support correct text returned with Job.GetString if Job.Success = False. Upvote 0
DonManfred said: Code: Copy Dim parser As JSONParser parser.Initialize(your json string here) Dim root As Map = parser.NextObject Dim error As String = root.Get("error") Dim error_description As String = root.Get("error_description") Click to expand... Httputils2 framework works incorrectly and Job.GetString doesn't return correct text with JSON data. For some errors, b4a raises exception about misssing cache file, for others it returns text, but not with correct JSON error data. It's necessary to fix something to support correct text returned with Job.GetString if Job.Success = False.
B b4auser1 Well-Known Member Licensed User Longtime User Jun 20, 2015 #6 I have modified the sources of HTTPUtils2 provided by Erel and commented all my modifications. Upvote 0