GOAuth An Oauth consumer Written in Go V 0.0.5

Overview
GOAuth
======

This is the source code repository for the GOAuth an OAuth consumer
written on the Go programming language.

Copyright 2010 The GOAuth Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.

V 0.0.5

Example Usage :

...

var AT *goauth.AccessToken
var goauthcon *goauth.OAuthConsumer

...

GET OAuth
---------

	r, err := goauthcon.Get(
		"http://api.twitter.com/1/account/verify_credentials.json",
		nil,
		AT )


POST OAuth 
----------
	
	r, err := goauthcon.Post(
		"http://api.twitter.com/1/statuses/update.json",
		goauth.Params{
			&goauth.Pair{Key:"status", Value:"Testing Status Update via GOAuth - OAuth consumer for #Golang"},
		},
		AT )

More Complete Example 
---------------------

See example.go for a simple http example that connects to twitter 
allows you to get the Home Time Lime for the OAuthed twitter account, 
send a tweet & Check Credentials. 

Note that the Check Credentials & Home Time Line use GET methods and the 
Update status uses a POST method.

Another Example (example_buzz) shows a simple Google Buzz Consumer
that searching for activites.  Note: This example is dependant on 
my gobuzz package here : http://github.com/hokapoka/gobuzz

Revision History 
----------------

    == Version 0.0.5 ==
	
	Minor changes to make GetRequestToken more robust.

	Until now, if the ConsumerKey / ConsumerSecrets were incorrect
	there was no feedback to the consumer that it had failed to 
	obtain the Request token correctally.

	Now the consumer returns the an error that reflects the status
	that has been returned from the OAuth service.  Additionally 
	it also returns an error if to token has been recivied even if
	the service hasn't responed with an error.

	An additional Exported member has been added to the AccessToken
	that allows it to be stored in a persistant data store with the 
	service that it relates to.

    == Version 0.0.4 ==

	Added a Google Buzz example that demos the use of the package 
	with a google OAuth supported service. 

	Also added minor fix to the original twitter example so that 
	it works with the latest Exported interfaces provided by the 
	OAuthConsumer.

	Tested with : 
		Google Buzz, Calender, Adwords
		Twitter 
		Digg 
	
	All work.  

    == Version 0.0.3 ==

	Previous versions only worked with twitter.  Issues, especially
	with Googles API, have been fixed.
   
	Replaced URL Encoder with Calvin McAnarney version that conforms
	to RFC 3986.
	(https://github.com/csmcanarney/gooauth/blob/master/encode.go)
 
	Additional issues with Googles OAuth API fixed. - Inparticular 
	Certain chars contiained in their tokens end up getting double 
	encoded if you follow the RFC specification.  Current fix is a
 	bit of a hack, parts are allowed to be Encoded twice, and then
	replaced with the actual values that should be sent.

	Tested with Googles Buzz, Adwords, Calender & Reader OAuth 
	servies all functions as expected. 

	Additional testing is required with other services, such as
	twitter, digg to see if these fixes have effected these.

		oauth.Get now recives a Params object too. 

   == Version  0.0.2 ==
   
	Minor fixes to Makefile to work with latest revision of Go. 
	Additional fixes to other changes in Go.


   == Version 0.0.1 ==

	Initial release, general mechs are functional GET/POST, creation
	of an OAuth consumer.

Contact 
-------

If you have any issues please feel free to contact : 

    email - [email protected]
      web - http://go.hokapoka.com
     buzz - [email protected] 
  twitter - @hokapokadotcom
   github - github.com/hokapoka/goauth
      irc - hokapoka (freenode #go-nuts)


============================================================

TODO : add link to example on go.hokapoka.com (once written)


Comments
  • example.go is broken

    example.go is broken

    I'm trying to use your package and compile example.go file.

    However I got such compile errors for such Go version: 8g -V: 8g version 7002

    Compile errors: 8g example.go example.go:100: cannot use AT (type *oauth.AccessToken) as type oauth.Params in function argument example.go:100: not enough arguments to function call example.go:131: cannot use AT (type *oauth.AccessToken) as type oauth.Params in function argument example.go:131: not enough arguments to function call

    opened by gladimdim 4
  • malformed http header

    malformed http header

    Hi hokapoka. Nice project there.

    It looks like the HTTP requests generated by goauth are messed up. In my case, my HTTP proxy (squid) is complaining because the HTTP request is bogus.

    See http://gist.github.com/544467 for a full tcpdump

    I'm guessing the problem is the HTTP request is missing a new line after "Authorization: OAuth ".

    Also, the parsing of the server response in GetRequestAuthorizationURL isn't very robust. When it doesn't find the response, it goes on with an empty token, which isn't ideal. It should also check the server response code. In my case, the HTTP proxy is returning a 501. Yet the code simply goes on.

    I believe you should take a look again at the upstream http package. It seems to provide a way now to set request headers, so maybe you can retire some of that custom code in http.go.

    I was planning to provide a patch instead of opening this issue, but I saw you are already writing oauth 2.0 support, so maybe some of this code will be deprecated anyway.

    Cheers, nictuku

    opened by nictuku 2
  • Fixed compile error:

    Fixed compile error:

    oauthconsumer.go:114: too many arguments in call to strings.Split oauthconsumer.go:118: too many arguments in call to strings.Split oauthconsumer.go:215: too many arguments in call to strings.Split oauthconsumer.go:219: too many arguments in call to strings.Split

    with 6g version release.r59 9022

    opened by psycho42 0
  • Testcase urlencode

    Testcase urlencode

    You should be able to pull this as well. The URLEncoding is failing with multi-byte runes. I think I'll fix that along the way on the "Code simplify" branch as I go through the code. Don't pull code-simplify though. It doesn't work (yet) :P

    opened by jlouis 0
  • Make goauth compile with latest Go release.

    Make goauth compile with latest Go release.

    In the latest Go release, the URL parsing from the http package was moved to the url package. This patch fixes this so that goauth can be built with the latest Go release.

    opened by akrennmair 0
  • Crash on nil req.Header in http.get() in Twitter example

    Crash on nil req.Header in http.get() in Twitter example

    $ cd goauth/example $ ./example 2011/05/29 22:55:59 web.go serving 0.0.0.0:7177 2011/05/29 22:56:10 GET / 2011/05/29 22:56:10 GET /favicon.ico 2011/05/29 22:56:18 GET /signin/twitter 2011/05/29 22:56:18 Handler crashed with error runtime error: lookup in nil map 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/runtime/proc.c 1041 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/runtime/runtime.c 116 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/runtime/hashmap.c 818 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/net/textproto/header.go 15 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/http/header.go 15 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/github.com/ijt/goauth/http.go 22 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/github.com/ijt/goauth/oauthconsumer.go 91 2011/05/29 22:56:18 /Users/issactrotts/repos/goauth/example/example.go 62 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/reflect/value.go 583 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/reflect/value.go 433 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/github.com/hoisie/web.go/web.go 273 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/github.com/hoisie/web.go/web.go 376 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/github.com/hoisie/web.go/web.go 249 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/http/server.go 728 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/http/server.go 499 2011/05/29 22:56:18 /Users/issactrotts/repos/go/src/pkg/runtime/proc.c 178

    opened by ijt 0
  • JustinTV requires Content-Length for POST

    JustinTV requires Content-Length for POST

    Hello,

    the Justin.tv REST API requires a Content-Length value in the header for a oauth POST. Eg. after line 312 in oauthconsumer.go adding: "Content-Length":len(buf),

    opened by ghost 0
  • panic: runtime error: lookup in nil map

    panic: runtime error: lookup in nil map

    Hi I'm trying to get the first step of the OAUTH process working and I get panic: runtime error: lookup in nil map from goauthcon.GetRequestAuthorizationURL()

    code: goauthcon = &oauth.OAuthConsumer{ Service:"twitter", RequestTokenURL:"http://twitter.com/oauth/request_token", AccessTokenURL:"http://twitter.com/oauth/access_token", AuthorizationURL:"http://twitter.com/oauth/authorize", ConsumerKey:"realkey", ConsumerSecret:"realsecret", CallBackURL:"oob", }

    line 29: s, rt, err := goauthcon.GetRequestAuthorizationURL()

    Full error:

    panic: runtime error: lookup in nil map

    runtime.panic+0xa4 /home/donp/src/go/repo/src/pkg/runtime/proc.c:1054 runtime.panic(0x8116fc8, 0x97702750) runtime.panicstring+0x95 /home/donp/src/go/repo/src/pkg/runtime/runtime.c:116 runtime.panicstring(0x82ae79a, 0x86bfab8) runtime.mapaccess1+0x17 /home/donp/src/go/repo/src/pkg/runtime/hashmap.c:809 runtime.mapaccess1(0x0, 0x81094c4) net/textproto.MIMEHeader·Add+0x50 /home/donp/src/go/repo/src/pkg/net/textproto/header.go:15 net/textproto.MIMEHeader·Add(0x0, 0x81094c4, 0xc, 0x8108a34, 0xa, ...) http.Header·Add+0x3f /home/donp/src/go/repo/src/pkg/http/header.go:15 http.Header·Add(0x0, 0x81094c4, 0xc, 0x8108a34, 0xa, ...) github%2ecom/hokapoka/goauth.get+0xd0 /home/donp/src/go/repo/src/pkg/github.com/hokapoka/goauth/http.go:22 github%2ecom/hokapoka/goauth.get(0x811eb80, 0x26, 0x97714be0, 0x0, 0x0, ...) github%2ecom/hokapoka/goauth._OAuthConsumer·GetRequestAuthorizationURL+0xb0e /home/donp/src/go/repo/src/pkg/github.com/hokapoka/goauth/oauthconsumer.go:91 github%2ecom/hokapoka/goauth._OAuthConsumer·GetRequestAuthorizationURL(0x977149b0, 0x977149b0, 0x977022e8) main.main+0xf5 /home/donp/src/go/gobot/gotwit.go:29 main.main() runtime.mainstart+0xf /home/donp/src/go/repo/src/pkg/runtime/386/asm.s:93 runtime.mainstart() runtime.goexit /home/donp/src/go/repo/src/pkg/runtime/proc.c:150 runtime.goexit()

    opened by donpdonp 2
Goauth - Basic username password cookie based authentication with Go Lang

goauth [WIP] Basic username password cookie based authentication with Go Lang Overview Use a Postgres DB to store Sign-in and Sign-up info Redis for c

Joseph Chen 0 Jan 4, 2022
Example of a simple application which is powered by a third-party oAuth 2.0 server for it's authentication / authorization. Written in Golang.

go mod init github.com/bartmika/osin-thirdparty-example go get github.com/spf13/cobra go get github.com/openshift/osin go get github.com/openshift/osi

Bartlomiej Mika 0 Jan 4, 2022
A Go library for doing header-based OAuth over HTTP or HTTPS.

Installation goinstall github.com/alloy-d/goauth Usage import ( "github.com/alloy-d/goauth" "os" ) func someFuncThatDoesStuffWithOAuth() (er

Adam Lloyd 24 Sep 2, 2020
[NO LONGER MAINTAINED} oauth 2 server implementation in Go

hero hero is a feature rich oauth 2 server implementation in Go. Features User account management Client management oauth 2 rfc 6749 compliant Configu

Geofrey Ernest 213 Nov 18, 2022
OAuth 1.0a implementation in Go

Package oauth1a Summary An implementation of OAuth 1.0a in Go1. API reference Installing Run: go get github.com/kurrik/oauth1a Include in your source

Arne Roomann-Kurrik 24 Aug 23, 2022
OAuth 1.0 implementation in go (golang).

OAuth 1.0 Library for Go (If you need an OAuth 2.0 library, check out: https://godoc.org/golang.org/x/oauth2) Developing your own apps, with this libr

Matt Jones 264 Nov 22, 2022
A library for performing OAuth Device flow and Web application flow in Go client apps.

oauth A library for Go client applications that need to perform OAuth authorization against a server, typically GitHub.com. Traditionally,

GitHub CLI 352 Dec 30, 2022
an SSO and OAuth / OIDC login solution for Nginx using the auth_request module

Vouch Proxy An SSO solution for Nginx using the auth_request module. Vouch Proxy can protect all of your websites at once. Vouch Proxy supports many O

Vouch 2.1k Jan 4, 2023
Casdoor is a UI-first centralized authentication / Single-Sign-On (SSO) platform based on OAuth 2.0 / OIDC.

A UI-first centralized authentication / Single-Sign-On (SSO) platform based on OAuth 2.0 / OIDC

Casbin 4.8k Dec 29, 2022
OAuth 2.0 middleware service for chi (ported from gin by community member)

oauth middleware OAuth 2.0 Authorization Server & Authorization Middleware for go-chi This library was ported to go-chi from https://github.com/maxzer

go-chi 17 Dec 8, 2022
Server bridging Google's OAuth and service using Radius for authentication

Fringe Fringe is an easy workaround for Google Workplace users who need a Radius server to perform authentication on behalf of other services (e.g. 80

Pierre-Luc Simard 5 Mar 7, 2022
Demonstration of sharing secret data between an OAuth/OIDC client and an Identity Providers web client.

OAuth / OIDC Cubbyhole Share secret data between client applications. This is mostly a demonstration of some of the work I've been evaluating at Storj

mya 3 Mar 21, 2022
A library for Go client applications that need to perform OAuth authorization against a server

oauth-0.8.0.zip oauth A library for Go client applications that need to perform OAuth authorization against a server, typically GitHub.com. Traditiona

tigressma 1 Oct 13, 2021
OauthMicroservice-cassandraCluster - Implement microservice of oauth using golang and cassandra to store user tokens

implement microservice of oauth using golang and cassandra to store user tokens

Mehdi 1 Jan 24, 2022
Authentication Plugin for implementing Form-Based, Basic, Local, LDAP, OpenID Connect, OAuth 2.0, SAML Authentication

Authentication Plugin for implementing Form-Based, Basic, Local, LDAP, OpenID Connect, OAuth 2.0, SAML Authentication

Paul Greenberg 697 Jan 8, 2023
A standalone, specification-compliant, OAuth2 server written in Golang.

Go OAuth2 Server This service implements OAuth 2.0 specification. Excerpts from the specification are included in this README file to describe differe

Richard Knop 2k Dec 28, 2022
HMAC-based JWT written in Go

JWT JSON Web Tokens JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties. Usage of jwt:

Pedro Albanese 0 Nov 16, 2021
A command-line tool to visualize a JWT token's content, written in Go

jat A command-line tool to visualize a JWT token's content, written in Go. Usage jat <some-jwt> Install Navigate to the Releases page; Download the co

Matheus Calegaro 1 Jan 6, 2022
Example App written in Golang for provide AuthZ/N using JWT

RCK Auth Application Example App written in Golang for provide Authentication & Authorization using Json Web Tokens. Run with Docker / Podman Run a Po

Roberto Carratala 2 Feb 25, 2022