tarickb / sasl-xoauth2

SASL plugin for XOAUTH2
Other
72 stars 20 forks source link

Problem with Token on Ubuntu #47

Closed Flobo1709 closed 1 year ago

Flobo1709 commented 1 year ago

Hi,

we followed your tutorial, with Office 365 and Ubuntu 22.04 LTS. We fail at this point sasl-xoauth2-token-tool get-token outlook --client-id=123ABC --tenant=DEG456

how do we have to set the command to write the output to the file? PATH_TO_TOKENS_FILE does not work for us, no matter which path we enter.

Can you please give me an example, thank you.

tarickb commented 1 year ago

Yeah it looks like the library sasl-xoauth2-token-tool uses to parse arguments is a little finicky. I tried this myself on Ubuntu 22.04 and the following should work:

sasl-xoauth2-token-tool get-token outlook /tmp/sasl-token.json --client-id="foo" --tenant="bar"

(In other words the filename has to appear before --client-id.)

I'll try to fix this in a future release.

Flobo1709 commented 1 year ago

Thanks, that worked, unfortunately I have another error now When checking the token I get the following message

2022-10-06 16:23:37: TokenStore::Read: file=/etc/tokens/mail@provider.de.json 2022-10-06 16:23:37: TokenStore::Read: refresh=0., 2022-10-06 16:23:37: TokenStore::Refresh: attempt 1 2022-10-06 16:23:37: TokenStore::Refresh: token_endpoint: https://login.microsoftonline.com/common/oauth2/nativeclient 2022-10-06 16:23:37: TokenStore::Refresh: Request: client_id=ebea86fd-fhGT9GYOcU16C 2022-10-06 16:23:37: TokenStore::Refresh: code=200, response= 2022-10-06 16:23:37: TokenStore::Refresh: exception=* row 1, column 1 Syntax error: value, object or array expected.

Can you help me?

tarickb commented 1 year ago

Something looks wrong with the request that's being sent (TokenStore::Refresh: Request: client_id=ebea86fd-fhGT9GYOcU16C) -- did you truncate or otherwise modify that log line when you copied it here? Client IDs are UUIDs, as far as I can tell, and ebea86fd-fhGT9GYOcU16C doesn't look like a UUID to me. Please confirm that your token file (/etc/tokens/mail@provider.de.json) looks something like this:

{
    "access_token": "abcdef...",
    "refresh_token": "abcdef...",
    "expiry": 0
}
tarickb commented 1 year ago

I deleted your comment because in general you don't want to make your tokens or client IDs public.

What version of sasl-xoauth2 are you running? Did you build it yourself or are you using the binaries from the PPA?

Flobo1709 commented 1 year ago

Hi, we are using the binaries from PPA. sasl-xoauth2 0.17-1ubuntu1~jammy1~ppa1 amd64 SASL extension for XOAUTH2

Flobo1709 commented 1 year ago

Would it be possible that you would otherwise make the setup together with me once? Gladly against payment via Paypal? I currently do not know what else is wrong. The refresh token fails during the check. I have taken the client ID from the Azure page, this is displayed in the overview. To do this, I created the app under the user with which I want to send and copied the ID. Or do I still need to configure something under Client Credentials in Azure and use this ID?

Thanks

tarickb commented 1 year ago

There's certainly no need for payment or anything like that. Please email me (tarick@bedeir.com) the full logs from your most recent attempt to refresh your token, including the full command line you're using, and we'll take it from there.