Ubuntu SeaDrive without GUI - obtain auth token with two-factor

I’m setting up SeaDrive client on Ubuntu (xenial) without GUI. I’m following the steps in the wiki (https://www.seafile.com/en/help/drive_client_linux/). I have two-factor authentication enabled. When I try to retrieve the token using this command (curl -d "username=username@example.com" -d “password=123456” https://seafile.example.com/api2/auth-token/) I receive the error:
{“non_field_errors”:[“Two factor auth token is missing.”]}

How can I include my two factor auth token in the curl command?

Hey fernanja,

were you able to find anything regarding the topic? I’d also have to generate tokens for several programs, and turning 2FA on and off every time is kind of a hassle.

Thanks & regards

Hey, no luck yet. I might start actively reaching out to other users on the forum.

I figure this out from the source code. https://github.com/haiwen/seahub/blob/master/seahub/api2/serializers.py#L114
Just need to add -H "X-SEAFILE-OTP: 123456" to the curl request.

The whole command looks like:
curl -d "username=username@example.com&password=123456" -H "X-SEAFILE-OTP: 123456" https://cloud.seafile.com/api2/auth-token/

Need to update Web API doc for this option.