AtakamaLLC / cloudsync

Python Cloud Synchronization Library
Other
26 stars 4 forks source link

onedrive: parameter 'redirect_uri' is not valid #378

Open magowiz opened 3 years ago

magowiz commented 3 years ago

Hi I'm trying to use cloudsync with mine onedrive, I tried the same code I used for gdrive but it didn't worked, it claims about wrong redirect_uri, but I don't know how to tell cloudsync the right redirect uri and both have that localhost uri working on my machine. The error I get:

invalid_request: The provided value for the input parameter 'redirect_uri' is not valid. The expected value is a URI which matches a redirect URI registered for this client application.
oauth_config = cloudsync.oauth.OAuthConfig(
                 app_id=app_id,
                 app_secret=app_secret)

# handles token
def __connect__(self):
        """connect to gdrive"""
        if not os.path.isfile(self.creds_files['token']):
            creds_auth = self.remote.authenticate()
            print(creds_auth)
            with open(self.creds_files['token'], "w") as tkf:
                tkf.write(json.dumps(creds_auth))
        else:
            with open(self.creds_files['token'], "r") as tkf:
                try:
                    creds_auth = json.load(tkf)
                except json.decoder.JSONDecodeError:
                    creds_auth = tkf.read()
        self.remote.connect(creds_auth)

for onedrive I don't have a json file with app_id and secret but I got it in variables, so I use it from them, what I am missing now?

magowiz commented 3 years ago

it comes out that cloudsync onedrive implementation has 'common' endpoint hardcoded, while applications with audience set to personal users only must use consumers in place of common, I changed my app manifest to Public and AzureAD and I was able to authorize using that code. Do you think that someway the cloudsync onedrive provider should handle also "consumers" ?

magowiz commented 2 years ago

still no news about it ?