Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect onedrive return bad request #2314

Closed
neal-learnformula opened this issue Jun 9, 2020 · 5 comments
Closed

Connect onedrive return bad request #2314

neal-learnformula opened this issue Jun 9, 2020 · 5 comments
Assignees
Labels
Companion The auth server (for Instagram, GDrive, etc) and upload proxy (for S3)

Comments

@neal-learnformula
Copy link

I try to upload documents from onedrive, after authorization, it will redirect to the page "~/onedrive/callback" and the page shows "bad requset". I have already registered my app and added the callback url as oauth redirect uri on the Microsoft account. Also I can successfully connect to google and dropbox.

@thmclellan
Copy link

In the Azure portal under App registrations, try setting up the callback as domain.com/connect/microsoft/callback. I found I had to choose the "Web" style redirect URI for the authorization code flow. (If you choose PWA then you'll get a PKCE error). More background at https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/graph-oauth?view=odsp-graph-online#code-flow.

@arturi arturi added Companion The auth server (for Instagram, GDrive, etc) and upload proxy (for S3) and removed Bug Triage labels Jun 10, 2020
@neal-learnformula
Copy link
Author

@thmclellan Thanks for your reply. Under my registered application, I have gone to the authorization and add the web redirect uri domain.com/connect/microsoft/callback, but it still shows bad request after authorization. Are there any other settings?

@thmclellan
Copy link

@neal-learnformula After a lot of troubleshooting I was able to get it working yesterday running on a Heroku server (running standalone companion similar to the example), but I had errors when running the companion server on localhost, I might have misconfigured it.

I found it helped to set COMPANION_DEBUG=true, look for hints in the companion server logs, and to run Chrome Network tools to watch the step by step going through the authorization code flow. This article was also useful: https://developer.okta.com/blog/2018/04/10/oauth-authorization-code-grant-type

On the Azure portal, under the web URI redirect configuration, I have these settings.

Screen Shot 2020-06-10 at 10 01 15 AM

Hope that helps - good luck!

@thmclellan
Copy link

One last thing... you might have this already, but you need to set API permissions for the Microsoft Graph API under Azure app registration like this:

image

@neal-learnformula
Copy link
Author

@thmclellan Thank you so much for your help and hope it's working this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Companion The auth server (for Instagram, GDrive, etc) and upload proxy (for S3)
Projects
None yet
Development

No branches or pull requests

4 participants