REM $Id: oauth2_example_office365.bat,v 1.9 2024/05/16 14:05:06 gilles Exp gilles $ @REM I hope you can read @REM A line beginning with @REM is a comment @REM This batch script is for Windows users, but not for Linux users, nor MacOS users. @SETLOCAL @REM This stuff is there to be able to run this batch with a double-clic @ECHO Currently running through %0 %* @REM the following command change current directory to the dirname of the current batch pathname @REM CD /D %~dp0 @PUSHD %~dp0 @ECHO @ECHO Getting OAUTH2 tokens @IF NOT EXIST tokens MKDIR tokens @REM !!! The following CALL lines are the only part to edit !!! @REM Replace the email by the email you want an access token to be used with imapsync @REM For an account from any OAUTH2 provider it will be like the following example @REM with all values changed: CALL .\oauth2_imap.exe ^ --local ^ --startover ^ --token_file "tokens\oauth2_tokens_gilles.lamiral@outlook.com.txt" ^ --client_id "c46947ca-867f-48b7-9231-64213fdd765e" ^ --client_secret "LH58Q~vMFFoVTbBmUnOeIDtfcacYNolMJ2cP2cLC" ^ --authorize_uri "https://login.microsoftonline.com/common/oauth2/v2.0/authorize" ^ --token_uri "https://login.microsoftonline.com/common/oauth2/v2.0/token" ^ --scope_string "offline_access https://outlook.office.com/IMAP.AccessAsUser.All" ^ --imap_server "outlook.office365.com" ^ gilles.lamiral@outlook.com @REM END OF PART TO EDIT @REM Some extra features: @REM You can specify the token file with the option --token_file @REM example: @REM CALL .\oauth2_imap.exe --token_file my_token_file_the_name_I_want.txt gilles.lamiral@outlook.com @REM You can use localhost as the authentication redirect_uri using the --local option: @REM CALL .\oauth2_imap.exe --local gilles.lamiral@outlook.com @POPD @PAUSE