{ ^_^ } sinustrom Solving life, one problem at a time!


A two-factor OATH token URI generator

oath-uri is an open source C/C++ library and command line tool to generate OATH TOTP/HOTP key sharing URI for soft tokens, also known as one-time password authentication applications.

When setting up two-factor authentication a secret must be shared with the user to set up their soft token (typically a smartphone authenticator app). This information is usually delivered via QR codes, which use a special key URI format, that was defined by Google Authenticator. This library fully implements those specifications, however note that most smarthone applications will support only a subset of types, and features of the standard!

Get it!


Source code


Latest source:



The oathuri command line tool is intended to be used in tandem with qrencode to provide an easy way to generate authenticator application key sharing URIs and associated QR codes.

Sample usage:

$ oathuri -0 JBSWY3DPEHPK3PXP alice@example.com example.com | qrencode -t ANSI

This will generate a QR code into your terminal for a simple 6 digit TOTP key, that you can scan with your smartphone.

To change to HOTP mode or to adjust the URI to the specifics of your authentication system, check out the oathuri(1) man page.


liboathuri is used under the hood in the CLI and it’s also available to be used by your C/C++ software. To learn the API read the oathuri.h(3) man page.

Building from source

Build time depencencies

Run time dependencies

Compiling & installing

To build and install oath-uri tool and library after extracting sources run:

$ cmake .
$ make
$ make install

Copyright (C) 2017-2018 Zoltan Puskas
The library is licensed under GNU LGPLv2.1 or later
The command line tool is licensed under GNU GPLv3 or later