예제 #1
0
파일: hello.go 프로젝트: neguse/webapp-gae
func NewTwitterClient(ctx context.Context) *oauth.Consumer {
	httpClient := urlfetch.Client(ctx)
	c := oauth.NewCustomHttpClientConsumer(
		TwitterConsumerKey, TwitterConsumerSecret,
		oauth.ServiceProvider{
			RequestTokenUrl:   "https://api.twitter.com/oauth/request_token",
			AuthorizeTokenUrl: "https://api.twitter.com/oauth/authorize",
			AccessTokenUrl:    "https://api.twitter.com/oauth/access_token",
		}, httpClient)
	return c
}
예제 #2
0
func newConsumer(credentials *Credentials, client *http.Client) *oauth.Consumer {

	return oauth.NewCustomHttpClientConsumer(
		credentials.ConsumerKey,
		credentials.ConsumerSecret,
		oauth.ServiceProvider{
			RequestTokenUrl:   requestUrl,
			AuthorizeTokenUrl: authUrl,
			AccessTokenUrl:    tokenUrl,
		},
		client,
	)
}