1

I'm looking for an easy solution or work-around for the following. I am working remotely on my Raspberry Pi by using SSH (Putty) for code execution and WinSCP for file transfers to the Pi. My project consists of a motion detection system and the Raspberry camera to detect movement and take a sequence of snapshot pictures, that will be instantly uploaded to OneDrive.

I'm using this textbook code for the OneDrive authorization and authentication:

import onedrivesdk
from onedrivesdk.helpers import GetAuthCodeServer


redirect_uri = 'http://localhost:8080/'
client_id = 'd5cXXXX-XXXXX-XXXX-XXXXXX89b8'
client_secret = 'eXXXXXXXXXXXXXXXt9L'

scopes = ['wl.signin', 'wl.offline_access', 'onedrive.readwrite']

client = onedrivesdk.get_default_client(client_id = client_id, scopes = scopes)

auth_url = client.auth_provider.get_auth_url(redirect_uri)

# After successful authorization, the authentication code is fetched from the server:
code = GetAuthCodeServer.get_auth_code(auth_url, redirect_uri)

client.auth_provider.authenticate(code, redirect_uri, client_secret)

This part works fine when working directly on the Raspberry Pi, i.e.: the web browser is launched and log-in is requested, after which the redirect uri is called and the authentication code is fetched.

What I am after is to find a way to be able to run the code directly via the SSH terminal without the browser interaction. If possible, I'd like the authorization to be done in textual format, and suppress the web browser from opening, because that results in "stuck" code on the SSH terminal...

El Fred
  • 330
  • 1
  • 7
  • 23

0 Answers0