C3
C3 copied to clipboard
Office365 channels: Add refresh token authentication
This PR adds refresh token authentication to both Office365 channels (OneDrive365RestFile, Outlook365RestTask).
The current version of C3 uses OAuth 2.0 Resource Owner Password Credentials (ROPC) to request & refresh OAuth access tokens in the Office365 channels. Access tokens expire every hour (by default) and need to be refreshed after that time. C3 currently only uses the ROPC authentication mechanism, which sends the username+password over the wire every time it needs to re-authenticate.
This pull-request improves the authentication flow by requesting, storing and re-using the refresh_token
provided by the OAuth login endpoint. The refresh_token
is then used to request new access tokens. As a fallback (e.g. in case the refresh token expires), C3 will automatically request new tokens using ROPC.
Additionally I've added a User Agent channel option, which sets the 'User-Agent' header in all HTTP requests. Using a well-known User-Agent helps with blending in with legitimate traffic (OPSEC).