This is actually not really an app, but a library.

I was inspired by some of the auth middlewares available for popular node.js frameworks such as grant or everyauth.

My entry is mainly based on grant in that it providers only oauth integration for golang. It takes care of implementation oddities and allows developers to insert the auth mechanism with very little code.

For example using Martini:

import (

func main() {
    // read config from somewhere
    config, err := readConfig()
    if err != nil {

    m := martini.Classic()

    // authy needs a session to be available
    m.Use(sessions.Sessions("authy", sessions.NewCookieStore([]byte(config.Secret))))
    // setup authy

    // pass the LoginRequired middleware to redirect the user automatically to the login page
    m.Get("/generic_callback", authy.LoginRequired(), func(token authy.Token, r render.Render) {
        r.HTML(200, "callback", token)


The config just need contains the providers the user want to use, the key and secret and finally the scope they want for everything to work. It also provides some conveniences like redirecting the user to login pages when the token is missing.

Built With

  • golang
  • martini
Share this project: