Hello!
I’m developing an application in which I need to upload video-recorded files to Microsoft One Drive.
At the moment, the recording is not an issue. The issue is to authenticate with One Drive Servers using Auth 2.0.
I’m using python, and have been following these guides:
I can get the “code” variable, but when I set it inside a .env file and spin a balena push, I get the following error:
Traceback (most recent call last):
main File "/usr/src/app/demo.py", line 21, in <module>
main client.auth_provider.authenticate(code, redirect_uri, client_secret)
main File "/usr/local/lib/python3.5/dist-packages/onedrivesdk/auth_provider.py", line 203, in authenticate
main data=params)
main File "/usr/local/lib/python3.5/dist-packages/onedrivesdk/http_provider.py", line 71, in send
main custom_response = HttpResponse(response.status_code, response.headers, response.text)
main File "/usr/local/lib/python3.5/dist-packages/onedrivesdk/http_response.py", line 61, in __init__
main raise Exception(str(message["error"]))
main Exception: invalid_request
Traceback (most recent call last):
main File "/usr/src/app/demo.py", line 21, in <module>
main client.auth_provider.authenticate(code, redirect_uri, client_secret)
main File "/usr/local/lib/python3.5/dist-packages/onedrivesdk/auth_provider.py", line 203, in authenticate
main data=params)
main File "/usr/local/lib/python3.5/dist-packages/onedrivesdk/http_provider.py", line 71, in send
main custom_response = HttpResponse(response.status_code, response.headers, response.text)
main File "/usr/local/lib/python3.5/dist-packages/onedrivesdk/http_response.py", line 61, in __init__
main raise Exception(str(message["error"]))
main Exception: invalid_grant
Searching and trying to understand the whole mechanism, apparently, I need to “save the session” somehow and load it every time I make a request to the servers. What I don’t understand yet is how I will do that. Maybe saving as a device variable? But it is possible to do that programmatically from inside the Raspberry Pi 3? Using balena-sdk?
I feel that I’m not doing it the right way with lots of workarounds…
What’s the recommended way for uploading a video to a Cloud service using balena?
Thank you!