Export exchange.

Allows users to exchange and retrieve a token
without initialising a Transport.
This commit is contained in:
Burcu Dogan 2014-08-11 00:27:43 -07:00
parent 6d8f8ea9d2
commit 4c579cbd0d
2 changed files with 3 additions and 3 deletions

View File

@ -150,7 +150,7 @@ func (c *Config) NewTransport() Transport {
// it succesffully retrieves a new token, creates a new transport
// authorized with it.
func (c *Config) NewTransportWithCode(exchangeCode string) (Transport, error) {
token, err := c.exchange(exchangeCode)
token, err := c.Exchange(exchangeCode)
if err != nil {
return nil, err
}
@ -184,7 +184,7 @@ func (c *Config) validate() error {
// Exchange exchanges the exchange code with the OAuth 2.0 provider
// to retrieve a new access token.
func (c *Config) exchange(exchangeCode string) (*Token, error) {
func (c *Config) Exchange(exchangeCode string) (*Token, error) {
token := &Token{}
vals := url.Values{
"grant_type": {"authorization_code"},

View File

@ -62,7 +62,7 @@ func TestExchangePayload(t *testing.T) {
return nil, errors.New("no response")
},
}
conf.exchange("exchange-code")
conf.Exchange("exchange-code")
}
func TestExchangingTransport(t *testing.T) {