ykpsmuttauth

command module
v0.0.0-...-4b68115 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2024 License: BSD-2-Clause Imports: 14 Imported by: 0

README

ykpsmuttauth

This simple program allows you to obtain an XOAUTH2 token for your YK Pao School Microsoft account. This is useful as a replacement for mutt_oauth2.py.

There are two implementations. One is a rather complete Go implementation, ykpsmuttauth, and one is a not really complete C implementation, ykpsmuttauth2.

Feature Go C
Authorize an account for the first time Yes No
Retrieve a new access token from a refresh token Yes Yes
Print an already-valid access token Yes Yes

The C implementation can read files produced by the Go implementation. It doesn't work the other way around because of some broken timezone handling.

The Go implementation has no dependencies other than the Go standard library. The C implementation depends on a POSIX standard library, and openssl for hashing, libcurl for HTTP requests, and json-c for JSON parsing and writing.

Usage

For the Go implementation,

Usage of ./ykpsmuttauth:
  -authorize string
    	email to newly authorize
  -tokenfile string
    	(required) persistent token storage

For the C implementation,

Usage: ./ykpsmuttauth2 <tokenfile>

Using with aerc

First run the Go implementation with ykpsmuttauth -tokenfile ~/.cache/aerc/token.txt -authorize s65535@ykpaoschool.cn.

[school]
from              = Your Name <s65535@ykpaoschool.cn>
default           = INBOX
copy-to           = Sent Items
source            = imaps+xoauth2://s65535%40ykpaoschool.cn@outlook.office365.com
outgoing          = smtp+xoauth2://s65535%40ykpaoschool.cn@outlook.office365.com:587
# To use the Go implementation:
source-cred-cmd   = ykpsmuttauth -tokenfile ~/.cache/aerc/token.txt
outgoing-cred-cmd = ykpsmuttauth -tokenfile ~/.cache/aerc/token.txt
# Or to use the C implementation:
# source-cred-cmd   = ykpsmuttauth2 ~/.cache/aerc/token.txt
# outgoing-cred-cmd = ykpsmuttauth2 ~/.cache/aerc/token.txt

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL