04-16-2020, 05:11 PM
This is an interesting update that will affect you at some point. Here is the scenario that brought this to our attention.
We are working on Appli and using LiveCloud Manager on the same computer. Sound familiar? It should as I bet most of you are doing this too.
If you sign in with the same credientials (developer on both apps), you run the risk of your app getting an updated API authentication key. LiveCloud Manager would then be denied access to the data because the same credentials are now using a new API auth key.
LCM did not deal with this situation nicely. The solution was to have LCM recognize that this happened and have it re-auth to get the updated API. To do this, we needed to make the gCSIauthA variable global. We could then have LCM try to auth again when the it ran into the problem. LCM could then continue doing what it needed to do.
Under normal circumstances, your clients would never be able to see this. This will only affect the developers that have an app they are developing open and LCM on the same computer. And, the app would need to have forced a new API key.
Here is an example of how LCM is handling this when it does a cdb_SDK() call:
get cdb_SDK("myProject")
if not cdb_result() then
if gCDBresultA["recent"]["response"] = "Error: Failed API Key Authentication" then
get cdb_auth (gCSIauthA["email"],gCSIauthA["password"],"developer")
get cdb_SDK("myProject")
if not cdb_result() then
return empty --YOU MAY WANT TO HAVE YOUR SOFTWARE GRACEFULLY RETURN TO THE LOGIN SCREEN
end if
end if
end if
Some extra thoughts:
You might find that this would have to be littered in many places. This solution is not practical. While our current solution works for our particular case, we may need to improve this further. One consideration is to have a callback for this situation.
You would get a new API that allows you to set the name of the handler to call when the callBack happens. We could then catch this problem reliably in all cases and then deal with it in one place. You would not need to place the example code above everywhere.
The steps we have taken so far allow LCM to work and lays the groundwork to do the full callBack solution.
We are working on Appli and using LiveCloud Manager on the same computer. Sound familiar? It should as I bet most of you are doing this too.
If you sign in with the same credientials (developer on both apps), you run the risk of your app getting an updated API authentication key. LiveCloud Manager would then be denied access to the data because the same credentials are now using a new API auth key.
LCM did not deal with this situation nicely. The solution was to have LCM recognize that this happened and have it re-auth to get the updated API. To do this, we needed to make the gCSIauthA variable global. We could then have LCM try to auth again when the it ran into the problem. LCM could then continue doing what it needed to do.
Under normal circumstances, your clients would never be able to see this. This will only affect the developers that have an app they are developing open and LCM on the same computer. And, the app would need to have forced a new API key.
Here is an example of how LCM is handling this when it does a cdb_SDK() call:
get cdb_SDK("myProject")
if not cdb_result() then
if gCDBresultA["recent"]["response"] = "Error: Failed API Key Authentication" then
get cdb_auth (gCSIauthA["email"],gCSIauthA["password"],"developer")
get cdb_SDK("myProject")
if not cdb_result() then
return empty --YOU MAY WANT TO HAVE YOUR SOFTWARE GRACEFULLY RETURN TO THE LOGIN SCREEN
end if
end if
end if
Some extra thoughts:
You might find that this would have to be littered in many places. This solution is not practical. While our current solution works for our particular case, we may need to improve this further. One consideration is to have a callback for this situation.
You would get a new API that allows you to set the name of the handler to call when the callBack happens. We could then catch this problem reliably in all cases and then deal with it in one place. You would not need to place the example code above everywhere.
The steps we have taken so far allow LCM to work and lays the groundwork to do the full callBack solution.