-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
HTTPStatus.BAD_REQUEST Bad request syntax with Office365 #59
Comments
I tried just now but wasn't able to replicate this issue. I had to select SSL rather than TLS in the Gmail alias settings because for whatever reason Gmail's TLS handshake with the proxy using my server's Let's Encrypt certificate did not work. However, after doing this it all works without issue, both with an imported pre-authenticated configuration file and via the In case it helps, I used a VPS (Debian 11) on which I've previously enabled TLS 1.0 via, e.g., My configuration file was mostly the same as yours, but I don't have a configuration that requires a tenant ID so couldn't test that part. I'd be quite surprised if this is the issue, though (unless it is something to do with your client ID requiring administrator approval?). Where are you getting this error, and is there any more context you can provide? |
Thanks for the quick reply!
I had to do the same. I also use a server with Let's Encrypt.
In my
In my case I am trying to enable a university account, what you suggest might be the case. I'll reach out to our IT services.
I see the message "Please visit the following URL to authenticate account"; I click on the URL, and I get redirected to the Microsoft login page. Then, I get another page that asks me whether I want to allow the SMTP.Send scope. Both pages are cleared with no issues. Then I get redirected back to the web server of the proxy, and that's when the error appears. Using logs, I could gather than |
Please could you share the log file with me? Feel free to email if you'd rather not post it here. |
I noticed that you are using an O365 Currently the proxy is set up to always expect a refresh token, so this could be one reason for the error (though doesn't explain the corrupted error string you encountered. 803cdce switches the code retrieval logic around slightly to only check the refresh token after trying the access token. Could you try this branch? |
I added
|
Did you add See the sample configuration file for an example of the correct scope string. What happens if you use that one? |
|
Ok, it's just that the log extract is I also see that your In addition, in almost all cases, the |
Azure doesn't accept it. It says
I used my public address, the one you can ping from the open web. I set the
Now a new issue popped up: when I try to change the app registration on Azure or create a new one, I get |
As the Azure message says, |
Alright, thanks! I'll get the Azure issue solved and try with |
ba3db1d makes this misconfiguration a bit more visible, giving a warning rather than the bad request error. The reason for requiring |
Still no luck, but I am a little confused. I tried with the following configurations:
and
None works: the browser complains that it can't open the server This is to be expected, and hence my confusion. I have no server running on my laptop (where I am not sure how to continue at this point. I do admit my understanding of OAuth2 and the Microsoft backend are minimal, so I'm sure there's something I am missing. EDIT: Because what fails is the first authentication, I will try with an ssh tunnel from my laptop to the remote server. This should work, in theory, and allow me to set EDIT2: The ssh tunnel did the trick, apparently! The final configuration was indeed with |
I'm going to close this issue since everything works as intended. Thank you so much for your help! |
Thanks for following up. Yes - if the proxy and client are separated, visiting the authentication redirection link needs to take place on the server rather than the client. If you're interested, #33 discusses various ways to separate this a bit more, but currently, since you need to have access to the server to get the authentication link, it's typically okay to handle it on there. I'm more than happy to look at pull requests that would develop this a bit more, but for the reasons mentioned in #33 it's not as trivial as it might first seem. |
Thanks for the link, I learned a lot from reading that issue. Because this is intended as a personal solution, I think that the current setup is acceptable for my purposes as is. |
When trying to access Office365 SMTP, I get the following error:
If I try to decode the string on the command line, I get:
My configuration follows the examples and is as follows:
I run the proxy as follows:
My goal is to send emails from GMail using its SMTP interface for aliases, so I am conducting my testing directly from there.
Thank you in advance for any help you can provide, and thanks for this great piece of software!
The text was updated successfully, but these errors were encountered: