I have succesfully retreived fields from my CloudData.net by fetching them into a TWebMyCloudDbClientDataset However, when I try to set the CDS to active at runtime, I need to login to myCloudData. Can I avoid this somehow?
You need to persist the access token (received via OnAccessToken) and set it again when initializing TWebMyCloudData for your new session via property WebMyCloudData.AccessToken: string;
Typically, this is persisted in local storage, for example with class TWebLocalStorage
I do not understand. I am using WebMyCloudDbClientDataset. You are rferring to the TWebMyCloudData, which is not mentioned in the docs. How do they interact?
I tried to use the TWebmyCloudData. I can successfully call connect, and get the token. However, when I run the app again and set the token via AccessToken (additionally I tried the PersistToken) the login dialog shows up. What am I missing?
I came up with this procedure now:
- Drop TWebMyCloudDBClientDataSet on the form and set all properties as needed
- set the active property to true
- run the app and login to MyCloud
The local storage now contains key/value for the access token.
I set the key/value in the formcreate using the TLocalStorage so no manual login is needed.
Also WebMyCloudDbClientDataset has the property AccessToken
Yes, but trying to access this generates an error: [Fehler] Unit1.pas(61): No member is provided to access property
I revisited this and the WebMyCloudDbClientDataset should automatically persist the access token in the local storage. The local storage key is 'myCloudData'. Please verify that you keep using the app from the same domain and after authentication, the next time, it should have picked up the access token from local storage. Verify in your browser console that you indeed see this value in local storage.
This was not my question. You are right, the access token is automatically persisted. What I wanted to know was, how to manually set the token. Now I do the fancy trick to manually persisting the token, prior to openning the CDS, which works.
Write one to local storage yourself as it is from there the component picks it up
This is what I am doing. My question still is unanswered:
How do I set the token manually?
Why can I not access WebMyCloudDbClientDataset the property AccessToken?
Thank you for your support!
BTW: TMS WebCore is an astonishing product! Awsome!
At this moment it cannot be set via a property as normally this isn't necessary and is fully managed by the component.
I see, thank you.
I have a folow up question. The procedure you described works, but only from my olffice, where I created the token. When I run the app from another PC at home, it seems as if the token is not valid. Is this true?
What I want to achive is to log some data from my app ion a dataset in myCloud.net, so I need some kind of anonymous or prevalidated access, otherwise all users of my app have to login to myCloud.net.
There is (by design) a machine dependency in the access token generation, so , there will be at least a one-time authentication and authorization needed.
This is bad. I can not force the users of my app to register on a third party site.
It is a security requirement