Okay, it seems that I have to extend the permissions for the app in the new Azure portal. In the past I used the old portal. That's why I used your manual: https://www.tmssoftware.com/site/cloudkey.asp#microsoft
You write:
In the Redirect URI section:
Select "Web"
Enter a valid redirect URL.
Exampe: "http://localhost:8000"
Do I have to change the callback URL in the OneDrive componenent also? Currently the callback url is https://login.live.com/oauth20_desktop.srf
My problem is I tried it also with http://localhost:8000 but then I will get an error message at browser login:
"invalid_request: The provided value for the input parameter 'redrirect_uri' is not valid. The expected value is a URI which matches a rediredt URI registered for this client application."
The application ID and the secret key are correct defined in the application.
Yes, I tried also the callback URL https://login.live.com/oauth20_desktop.srf and Port 80. It was my standard setting. But there I will get the error: "Could not bind socket. Address and port are already in use."
Then I changed the port to 8080 and after login I will get a blank page.
Btw. I use the OneDrive account also in my VCL program with the same credentials and settings and there it works. I can login and download/upload data.
Please note that when ExternalBrowser is set to true, it is recommended to use a local callback URL like: "http://localhost:8000"
Make sure that an identical URL is assigned to both the App.CallBackURL and in the Azure console, then authentication should work as expected after the update.
An update release for TMS FMX Cloud Pack is planned for next week. If you urgently require this fix you can request an incremental source update by sending an email to mailto:help@tmssoftware.com
thanks for the incremental source update. Now it works and I can access the OneDrive Cloud.
But after some times if I want to load files from there I have to reauthentificate my access. The app switches to the browser and address localhost:8000 and shows me the message "Application succesfully authorized. You can close this browser window".
Is there a AccessTokenLifeTime like in GoogleDrive?
Unfortunately there is no equivalent to AccessTokenLifeTime in OneDrive. This is a limitation of the OneDrive API which we have no control over.
However there should be a refresh token included with the access token after authentication which you can use in combination with a RefreshAccess call to avoid displaying the browser window. If you're using a Connect call to start authentication this is built-in.
Thank you for notifying us, there was indeed an issue related to the RefreshAccess. The issue has now been fixed and the update will be available with the next release.
My other apps were defined at the old Microsoft site https://apps.dev.microsoft.com/#/appList. And this apps work with "old" ClientID and SecretKey and the ExternalBrowser option.
The new app I set up at the Azure portal like the description in your manual https://www.tmssoftware.com/site/cloudkey.asp#microsoft
In my code I define
OneDrive.App.Key := Application (Client) ID;
OneDrive.App.Secret := Client Secret;
The redirect URI is localhost://8000 which is also defined as CallBackup Url in the component.
If I start the login all seems to be okay. From OneDrive I get the the information "Application successfully authorized. You can close the browser window."
But after closing the window nothing happens. In debug mode the app doesn't call any of the events in TTMSFMXCloudOneDrive component.
Does the issue happen on Windows as well? Have you tried using the log file to see if any error messages are displayed? Logging can be enabled by setting Logging to True and LogLevel to llDetail. The log file is generated automatically in the machine's Documents folder.
If the problem persists you can also try using Fiddler (free download) to view more details for the executed HTTP requests and possible error messages.
i checked the windows version and there is the same problem.
In the log file I can see the following messages:
<h2>Our services aren't available right now</h2><p>We're working to restore all services as soon as possible. Please check back soon.</p>
And:
20200422T111725:HTTPS POST RESULT:{"error":"invalid_request","error_description":"Public clients can't send a client secret.","correlation_id":"xxxx-yyyyy-zzzz"}
It seems Microsofts OneDrive has a problem since a few days. That would mean, that all users can't login via an app with the new client secret? There are no messages on the Azure protal about that problem.
The only solution will be, that I use the applictaion ID of one of my old apps to use it in my new app, since the problem will be solved...
20200422T111725:HTTPS POST RESULT:{"error":"invalid_request","error_description":"Public clients can't send a client secret.","correlation_id":"xxx-xxx-xxx-xxx-xxx"}