Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A Go library for doing header-based OAuth over HTTP or HTTPS.

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 .hgignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Makefile
Octocat-spinner-32 README.markdown
Octocat-spinner-32 error.go
Octocat-spinner-32 helpers.go
Octocat-spinner-32 http.go
Octocat-spinner-32 oauth.go
Octocat-spinner-32 persist.go
Octocat-spinner-32 url.go




import (

func someFuncThatDoesStuffWithOAuth() (err os.Error) {
    o := new (oauth.OAuth)
    o.ConsumerKey = "key"
    o.ConsumerSecret = "secret"
    o.Callback = "callback"

    o.RequestTokenURL = ""
    o.OwnerAuthURL = ""
    o.AccessTokenURL = ""

    err = o.GetRequestToken()
    if err != nil { return }

    url, err := o.AuthorizationURL()
    if err != nil { return }

    // somehow send user to url...

    var verifier string
    // somehow get verifier (or "PIN")...

    err = o.GetAccessToken(verifier)
    if err != nil { return }

    err = o.Save(os.Getenv("HOME") + "/.simple_example.oauth")

    response, err := o.Post(
        map[string]string{"status": "Just did a little OAuth dance!"})
    if err != nil { return }

    // do stuff with response...

    return nil


This is still a bit of a work in progress. The interface is subject to change (and become prettier), but I think it's mostly done.

It is probably obvious that it's rough around the edges in spots. Please let me know if anything's broken.

Something went wrong with that request. Please try again.