コード例 #1
0
ファイル: oauth.go プロジェクト: upamune/block
func getAccessToken(consumerKey, consumerSecret string) (a AccessToken, err error) {
	c := oauth.NewConsumer(
		consumerKey,
		consumerSecret,
		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",
		})

	requestToken, url, err := c.GetRequestTokenAndUrl("oob")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("(1) Go to: " + url)
	fmt.Println("(2) Grant access, you should get back a verification code.")
	open.Run(url)
	fmt.Print("(3) Enter that verification code here: ")

	verificationCode := ""
	fmt.Scanln(&verificationCode)

	authToken, err := c.AuthorizeToken(requestToken, verificationCode)
	if err != nil {
		log.Fatal(err)
	}
	a.Token = authToken.Token
	a.Secret = authToken.Secret

	err = saveAccessToken(a)

	return
}
コード例 #2
0
ファイル: twitter.go プロジェクト: gnoirzox/gohackernews
// Tweet sends a status update to twitter - returns the response body or error
func Tweet(s string) ([]byte, error) {
	consumer := oauth.NewConsumer(key, secret, oauth.ServiceProvider{})
	//consumer.Debug(true)
	token := &oauth.AccessToken{Token: accessToken, Secret: accessTokenSecret}

	url := "https://api.twitter.com/1.1/statuses/update.json"
	data := map[string]string{"status": s}

	response, err := consumer.Post(url, data, token)
	if err != nil {
		return nil, err
	}
	defer response.Body.Close()
	fmt.Println("Response:", response.StatusCode, response.Status)
	body, err := ioutil.ReadAll(response.Body)
	if err != nil {
		return nil, err
	}

	// Check for unexpected status codes, and report them
	if response.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("#error sending tweet, unexpected status:%d\n\n%s\n", response.StatusCode, body)
	}

	return body, nil
}
コード例 #3
0
func (self TwitterBot) GetMentions() ([]byte, error) {
	const uri = "https://api.twitter.com/1.1/statuses/mentions_timeline.json"
	params := map[string]string{
		"count": "800",
	}
	accessToken := &oauth.AccessToken{
		Token:  self.config["accessToken"],
		Secret: self.config["accessTokenSecret"],
	}

	consumer := oauth.NewConsumer(self.config["consumerKey"],
		self.config["consumerSecret"],
		*self.serviceProvider)

	resp, err := consumer.Get(uri, params, accessToken)
	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	return body, nil
}
コード例 #4
0
ファイル: client.go プロジェクト: dmikalova/discogs
func OAuth1() {
	consumerKey := "rPJwszCjnGXfRIjFquYD"
	consumerSecret := "kTIjZmEnGCNiQqqRgyhgUfOJFHnSAVdI"

	oauthConsumer = oauth.NewConsumer(
		consumerKey,
		consumerSecret,
		oauth.ServiceProvider{
			RequestTokenUrl:   "http://api.discogs.com/oauth/request_token",
			AuthorizeTokenUrl: "http://www.discogs.com/oauth/authorize",
			AccessTokenUrl:    "http://api.discogs.com/oauth/access_token",
		},
	)

	requestToken, url, err := oauthConsumer.GetRequestTokenAndUrl("oob")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("(1) Go to: " + url)
	fmt.Println("(2) Grant access, you should get back a verification code.")
	fmt.Println("(3) Enter that verification code here: ")

	verificationCode := ""
	fmt.Scanln(&verificationCode)

	accessToken, err = oauthConsumer.AuthorizeToken(requestToken, verificationCode)
	if err != nil {
		log.Fatal(err)
	}

	writeToken()
}
コード例 #5
0
func (self TwitterBot) SearchRealtime() ([]byte, error) {
	const uri = "https://api.twitter.com/1.1/statuses/filter.json"
	params := map[string]string{
		"track": "Letta",
	}
	accessToken := &oauth.AccessToken{
		Token:  self.config["accessToken"],
		Secret: self.config["accessTokenSecret"],
	}

	consumer := oauth.NewConsumer(self.config["consumerKey"],
		self.config["consumerSecret"],
		*self.serviceProvider)

	consumer.Debug(true)

	resp, err := consumer.Post(uri, params, accessToken)
	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()

	reader := bufio.NewReader(resp.Body)
	var (
		isprefix bool = true
		line     []byte
	)
	for isprefix && err == nil {
		line, isprefix, err = reader.ReadLine()
		fmt.Println("%s", line)
	}

	return nil, nil
}
コード例 #6
0
func (self TwitterBot) Unfollow(screenName string) ([]byte, error) {
	const uri = "https://api.twitter.com/1.1/friendships/destroy.json"
	params := map[string]string{
		"screen_name": screenName,
	}
	accessToken := &oauth.AccessToken{
		Token:  self.config["accessToken"],
		Secret: self.config["accessTokenSecret"],
	}

	consumer := oauth.NewConsumer(self.config["consumerKey"],
		self.config["consumerSecret"],
		*self.serviceProvider)

	resp, err := consumer.Post(uri, params, accessToken)
	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	return body, nil
}
コード例 #7
0
ファイル: oauth.go プロジェクト: pilwon/go-smugmug
func buildOAuthHTTPClient(consumerKey, consumerSecret, accessToken, accessTokenSecret string) (*http.Client, error) {
	consumer := oauth.NewConsumer(
		consumerKey,
		consumerSecret,
		oauth.ServiceProvider{
			RequestTokenUrl:   RequestTokenUrl,
			AuthorizeTokenUrl: AuthorizeTokenUrl,
			AccessTokenUrl:    AccessTokenUrl,
		},
	)
	consumer.AdditionalAuthorizationUrlParams = map[string]string{
		"Access":      URLParamAccessFull,
		"Permissions": URLParamPermissionsModify,
	}

	token := &oauth.AccessToken{
		Token:  accessToken,
		Secret: accessTokenSecret,
	}

	client, err := consumer.MakeHttpClient(token)
	if err != nil {
		return nil, err
	}

	return client, nil
}
コード例 #8
0
func main() {
	var consumerKey string = "golang-test-key"
	var consumerSecretPath string = "../../../../keys/8008/8080/" + consumerKey
	secret, err := ioutil.ReadFile(consumerSecretPath)
	check(err)
	consumerSecret := string(secret)

	c := oauth.NewConsumer(
		consumerKey,
		consumerSecret,
		oauth.ServiceProvider{
			RequestTokenUrl:   "",
			AuthorizeTokenUrl: "",
			AccessTokenUrl:    "",
		})

	//c.Debug(true)

	var emptyAccessToken oauth.AccessToken

	response, err := c.Get(
		"http://localhost:8008/job/12345",
		map[string]string{},
		&emptyAccessToken)
	if err != nil {
		log.Fatal(err)
	}

	defer response.Body.Close()

	bits, err := ioutil.ReadAll(response.Body)
	fmt.Println(string(bits))
}
コード例 #9
0
ファイル: main.go プロジェクト: ilgooz/rmdm
func makeClients() []*http.Client {
	var clients []*http.Client

	for _, key := range getKeys() {
		consumer := oauth.NewConsumer(
			key[0],
			key[1],
			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",
			})

		at := oauth.AccessToken{
			Token:  key[2],
			Secret: key[3],
		}

		client, err := consumer.MakeHttpClient(&at)
		if err != nil {
			log.Fatalln(err)
		}
		clients = append(clients, client)
	}

	return clients
}
コード例 #10
0
func main() {
	tokens = make(map[string]*oauth.RequestToken)

	config := parseConfig()

	c = oauth.NewConsumer(
		config.ConsumerApiKey,
		config.ConsumerSecret,
		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",
		},
	)

	r := httprouter.New()

	r.GET("/", IndexAction)
	r.GET("/api/auth", RedirectUserToTwitter)
	r.GET("/api/maketoken", GetTwitterToken)
	r.GET("/api/collage", GenerateCollageAction)
	r.GET("/api/verify_auth", VerifyAuthAction)

	r.ServeFiles("/static/*filepath", http.Dir("static/"))

	fmt.Println("Server running on port :8000")
	http.ListenAndServe(":8000", r)
}
コード例 #11
0
ファイル: context.go プロジェクト: Requilence/integram
// OAuth1Client returns oauth.Consumer using OAuthProvider details
func (o *OAuthProvider) OAuth1Client(c *Context) *oauth.Consumer {

	if o.ID == "" {
		log.Error(errors.New("Can't get OAuth1Client – ID not set"))
		return nil
	}

	service := c.Service()
	config := service.DefaultOAuth1

	if config.AccessTokenReceiver == nil {
		log.Error(errors.New("Can't get OAuth1Client – AccessTokenReceiver not set"))

		return nil
	}

	config.Key = o.ID
	config.Secret = o.Secret
	config.AccessTokenURL = replaceBaseURL(config.AccessTokenURL, o.BaseURL)
	config.AuthorizeTokenURL = replaceBaseURL(config.AuthorizeTokenURL, o.BaseURL)
	config.RequestTokenURL = replaceBaseURL(config.RequestTokenURL, o.BaseURL)

	consumer := oauth.NewConsumer(
		o.ID,
		o.Secret,
		oauth.ServiceProvider{
			RequestTokenUrl:   config.RequestTokenURL,
			AuthorizeTokenUrl: config.AuthorizeTokenURL,
			AccessTokenUrl:    config.AccessTokenURL,
		},
	)
	consumer.AdditionalAuthorizationUrlParams = service.DefaultOAuth1.AdditionalAuthorizationURLParams
	return consumer
}
コード例 #12
0
ファイル: authomato.go プロジェクト: Xion/authomato
func loadOAuthConsumers(filename string, oauthProviders OAuthProviders) (OAuthConsumers, error) {
	b, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, err
	}

	// parse the JSON into generic map
	var data map[string]interface{}
	err = json.Unmarshal(b, &data)
	if err != nil {
		return nil, err
	}

	// resolve references to OAuth providers and construct result
	consumers := make(OAuthConsumers)
	for k, v := range data {
		c := v.(map[string]interface{})

		provName := c["provider"].(string)
		if len(provName) == 0 {
			return nil, fmt.Errorf("unspecified provider for consumer: %s", k)
		}
		provider := oauthProviders[provName]
		if provider == nil {
			return nil, fmt.Errorf("unknown provider: %s", provName)
		}
		key, secret := c["key"].(string), c["secret"].(string)
		if len(key) == 0 || len(secret) == 0 {
			return nil, fmt.Errorf("unspecified key and/or secret for consumer: %s", k)
		}

		consumers[k] = oauth.NewConsumer(key, secret, *provider)
	}
	return consumers, nil
}
コード例 #13
0
func (self TwitterBot) GetFollowers(cursor string) ([]byte, error) {
	const uri = "https://api.twitter.com/1.1/followers/list.json"
	params := map[string]string{
		"count":                 "1000",
		"screen_name":           self.config["twitterHandle"],
		"skip_status":           "1",
		"include_user_entities": "0",
		"cursor":                cursor,
	}
	accessToken := &oauth.AccessToken{
		Token:  self.config["accessToken"],
		Secret: self.config["accessTokenSecret"],
	}

	consumer := oauth.NewConsumer(self.config["consumerKey"],
		self.config["consumerSecret"],
		*self.serviceProvider)

	resp, err := consumer.Get(uri, params, accessToken)
	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	return body, nil
}
コード例 #14
0
func (self TwitterBot) Search() ([]byte, error) {
	const uri = "https://api.twitter.com/1.1/search/tweets.json"
	params := map[string]string{
		"count":       "100",
		"q":           "#RivoluzDigitale",
		"result_type": "mixed",
	}
	accessToken := &oauth.AccessToken{
		Token:  self.config["accessToken"],
		Secret: self.config["accessTokenSecret"],
	}

	consumer := oauth.NewConsumer(self.config["consumerKey"],
		self.config["consumerSecret"],
		*self.serviceProvider)

	resp, err := consumer.Get(uri, params, accessToken)
	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	return body, nil
}
コード例 #15
0
ファイル: client.go プロジェクト: ifo/trelgo
func makeConsumer(conf Config, name, expiration, scope string) (*oauth.Consumer, error) {
	c := oauth.NewConsumer(
		conf.ConsumerKey,
		conf.ConsumerSecret,
		oauth.ServiceProvider{
			RequestTokenUrl:   conf.RequestTokenUrl,
			AuthorizeTokenUrl: conf.AuthorizeTokenUrl,
			AccessTokenUrl:    conf.AccessTokenUrl,
		},
	)

	if name == "" {
		return nil, fmt.Errorf("Application name required for oauth consumer")
	}
	c.AdditionalAuthorizationUrlParams["name"] = name
	err := validateExpiration(expiration)
	if err != nil {
		return nil, err
	}
	c.AdditionalAuthorizationUrlParams["expiration"] = expiration
	err = validateScope(scope)
	if err != nil {
		return nil, err
	}
	c.AdditionalAuthorizationUrlParams["scope"] = scope

	return c, nil
}
コード例 #16
0
func (self TwitterBot) GetTweets(user string) ([]byte, error) {
	const uri = "https://api.twitter.com/1.1/statuses/user_timeline.json"
	params := map[string]string{
		"count":       "200",
		"screen_name": user,
		//"trim_user": "******",
		//"max_id": "315451926944833537",
	}
	accessToken := &oauth.AccessToken{
		Token:  self.config["accessToken"],
		Secret: self.config["accessTokenSecret"],
	}

	consumer := oauth.NewConsumer(self.config["consumerKey"],
		self.config["consumerSecret"],
		*self.serviceProvider)

	resp, err := consumer.Get(uri, params, accessToken)
	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	return body, nil
}
コード例 #17
0
ファイル: twitter.go プロジェクト: eraclitux/twiph
func CallTwitter(ep string, query map[string]string) (io.ReadCloser, error) {
	consumer := oauth.NewConsumer(conf.ConsumerKey, conf.ConsumerSecret, oauth.ServiceProvider{})
	//consumer.Debug(true)
	accessToken := &oauth.AccessToken{
		Token:  conf.AccessToken,
		Secret: conf.AccessTokenSecret,
	}
	//	client, err := consumer.MakeHttpClient(accessToken)
	//	if err != nil {
	//		return t, err
	//	}
	//	query := url.QueryEscape("q=" + s + "&page=1&count=20")
	//	ep := fmt.Sprintf("%s/users/search.json?%s", twitterEndPoint, query)
	//	response, err := client.Get(ep)
	// FIXME this is deprecated but MakeHttpClient makes a bad
	// auth because do not encode "&" in "&amp"
	response, err := consumer.Get(twitterEndPoint+ep, query, accessToken)
	if err != nil {
		return nil, err
	}
	if response.StatusCode != 200 {
		b, _ := ioutil.ReadAll(response.Body)
		return nil, fmt.Errorf("%s, %s", http.StatusText(response.StatusCode), string(b))
	}
	return response.Body, nil
}
コード例 #18
0
ファイル: tweet.go プロジェクト: adamflott/syncgenie
func main() {
	var consumerKey string = os.Args[1]
	var consumerSecret string = os.Args[2]

	var tweet string = string(os.Args[5])

	c := oauth.NewConsumer(
		consumerKey,
		consumerSecret,
		oauth.ServiceProvider{
			RequestTokenUrl:   "http://api.twitter.com/oauth/request_token",
			AuthorizeTokenUrl: "https://api.twitter.com/oauth/authorize",
			AccessTokenUrl:    "https://api.twitter.com/oauth/access_token",
		})

	at := oauth.AccessToken{Token: os.Args[3], Secret: os.Args[4]}

	_, err := c.Post(
		"http://api.twitter.com/1/statuses/update.json",
		"",
		map[string]string{
			"key":    "",
			"status": tweet,
		},
		&at)

	if err != nil {
		log.Fatal(err)
	}
}
コード例 #19
0
ファイル: main.go プロジェクト: iknite/golang-workshop
func main() {
	var screenName *string = flag.String("name", "", "twitter user name")
	var consumerKey *string = flag.String("key", "", "")
	var consumerSecret *string = flag.String("secret", "", "")

	flag.Parse()

	fmt.Printf("fetching for: %s \n", *screenName)
	if *consumerKey == "" || *consumerSecret == "" {
		// panic("needed key and secret, exiting")
		log.Fatal("needed key and secret, exiting")
		os.Exit(1)
	}

	c := oauth.NewConsumer(
		*consumerKey,
		*consumerSecret,
		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",
		})

	c.Debug(true)

	requestToken, u, err := c.GetRequestTokenAndUrl("oob")
	if err != nil {
		log.Fatal(err)
	}

	exec.Command("google-chrome-stable", u).Run()

	fmt.Println("(1) Grant access, you should get back a verification code.")
	fmt.Println("(2) Enter that verification code here: ")

	verificationCode := ""
	fmt.Scanln(&verificationCode)

	accessToken, err := c.AuthorizeToken(requestToken, verificationCode)
	if err != nil {
		log.Fatal(err)
	}

	client, err := c.MakeHttpClient(accessToken)
	if err != nil {
		log.Fatal(err)
	}

	response, err := client.Get(
		"https://api.twitter.com/1.1/statuses/home_timeline.json?count=1")
	if err != nil {
		log.Fatal(err)
	}
	defer response.Body.Close()

	bits, err := ioutil.ReadAll(response.Body)
	fmt.Println("The newest item in your home timeline is: " + string(bits))

}
コード例 #20
0
ファイル: web.go プロジェクト: mocchira/digestw
func main() {
	var consumerKey *string = flag.String("consumerkey", "xxx", "")
	var consumerSecret *string = flag.String("consumersecret", "xxx", "")
	var cookieSecret *string = flag.String("cookiesecret", "xxx", "")
	var mongoUrl *string = flag.String("mongourl", "xxx", "")

	flag.Parse()

	consumer = oauth.NewConsumer(
		*consumerKey,
		*consumerSecret,
		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",
		})
	var err os.Error
	mgoPool, err = mgo.Mongo(*mongoUrl)
	if err != nil {
		panic(err)
	}
	defer mgoPool.Close()

	tplSet = new(template.Set)
	fmap := make(map[string]interface{})
	fmap["cut"] = CutString
	fmap["anchor"] = GenAnchorTagStr
	fmap["sn2url"] = GetTwitterAccountURL
	fmap["ht2url"] = GetSearchResultURL
	fmap["d2url"] = GetDomainURL
	tplSet.Funcs(fmap)
	tplSet = template.SetMust(
		tplSet.ParseTemplateFiles(
			"tpl/index.html",
			"tpl/place.html",
			"tpl/hashtag.html",
			"tpl/url.html",
			"tpl/domain.html",
			"tpl/sn.html",
			"tpl/tab.html",
			"tpl/link.html",
		))

	f, ferr := os.Create("server.log")
	if ferr != nil {
		panic(ferr)
	}
	logger := log.New(f, "", log.Ldate|log.Ltime)
	web.SetLogger(logger)
	web.Config.StaticDir = "../htdocs"
	web.Config.CookieSecret = *cookieSecret

	web.Get("/web/login", onLogin)
	web.Get("/web/callback", onCallback)
	web.Get("/web/stats/([0-9a-zA-Z_]+)/([a-z]+)/([0-9 ]*)", onStats)
	web.Get("/web", onStatsDef)
	web.Run("127.0.0.1:8080")

}
コード例 #21
0
ファイル: rdio.go プロジェクト: nickdirienzo/rdigo
func NewClient(consumerKey, consumerSecret string) Rdio {
	c := oauth.NewConsumer(consumerKey, consumerSecret,
		oauth.ServiceProvider{
			RequestTokenUrl:   "http://api.rdio.com/oauth/request_token",
			AuthorizeTokenUrl: "https://www.rdio.com/oauth/authorize",
			AccessTokenUrl:    "http://api.rdio.com/oauth/access_token",
		})
	return Rdio{consumer: c}
}
コード例 #22
0
ファイル: OAuth.go プロジェクト: edgarwang/FanfouStatusBakup
// Create a new Fanfou client, root should be RootFanfou or RootSandbox
func (c *Fanfou) NewFanfouClient() (*FanfouClient, error) {
	if c.Key == "" || c.Secret == "" {
		return nil, errors.New("No consumer key or secret")
	}

	return &FanfouClient{
		oauth.NewConsumer(c.Key, c.Secret, *fanfouService),
		c.AccessToken,
	}, nil
}
コード例 #23
0
ファイル: fantasy.go プロジェクト: e0/goff
// GetConsumer generates an OAuth Consumer for the Yahoo fantasy sports API
func GetConsumer(clientID string, clientSecret string) *oauth.Consumer {
	return oauth.NewConsumer(
		clientID,
		clientSecret,
		oauth.ServiceProvider{
			RequestTokenUrl:   YahooRequestTokenURL,
			AuthorizeTokenUrl: YahooAuthTokenURL,
			AccessTokenUrl:    YahooGetTokenURL,
		})
}
コード例 #24
0
ファイル: rdio.go プロジェクト: nickdirienzo/rdigo
func AuthenticatedClient(consumerKey, consumerSecret, accessToken, accessTokenSecret string) Rdio {
	token := oauth.AccessToken{Token: accessToken, Secret: accessTokenSecret}
	c := oauth.NewConsumer(consumerKey, consumerSecret,
		oauth.ServiceProvider{
			RequestTokenUrl:   "http://api.rdio.com/oauth/request_token",
			AuthorizeTokenUrl: "https://www.rdio.com/oauth/authorize",
			AccessTokenUrl:    "http://api.rdio.com/oauth/access_token",
		})
	return Rdio{consumer: c, AccessToken: &token}
}
コード例 #25
0
ファイル: init.go プロジェクト: wakuworks/retwitter
func GetClient() *oauth.Consumer {
	return oauth.NewConsumer(
		kocha.Getenv("RETWITTER_TWITTER_CONSUMER_KEY", ""),
		kocha.Getenv("RETWITTER_TWITTER_CONSUMER_SECRET", ""),
		oauth.ServiceProvider{
			AuthorizeTokenUrl: "https://api.twitter.com/oauth/authorize",
			RequestTokenUrl:   "https://api.twitter.com/oauth/request_token",
			AccessTokenUrl:    "https://api.twitter.com/oauth/access_token",
		},
	)
}
コード例 #26
0
ファイル: twitter.go プロジェクト: hasanozgan/zamazingo
func createTwitterOAuth() *oauth.Consumer {
	return oauth.NewConsumer(
		revel.Config.StringDefault("twitter.key", ""),
		revel.Config.StringDefault("twitter.secret", ""),
		oauth.ServiceProvider{
			AuthorizeTokenUrl: "https://api.twitter.com/oauth/authorize",
			RequestTokenUrl:   "https://api.twitter.com/oauth/request_token",
			AccessTokenUrl:    "https://api.twitter.com/oauth/access_token",
		},
	)
}
コード例 #27
0
ファイル: twitter.go プロジェクト: laicosly/go-social-twitter
func newConsumer(credentials *Credentials) *oauth.Consumer {

	return oauth.NewConsumer(
		credentials.ConsumerKey,
		credentials.ConsumerSecret,
		oauth.ServiceProvider{
			RequestTokenUrl:   requestUrl,
			AuthorizeTokenUrl: authUrl,
			AccessTokenUrl:    tokenUrl,
		})
}
コード例 #28
0
ファイル: auth.go プロジェクト: mingderwang/twitter-auth
func NewTwitterConsumer(consumerKey, consumerSecret string) *oauth.Consumer {
	return oauth.NewConsumer(
		consumerKey,
		consumerSecret,
		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",
		},
	)
}
コード例 #29
0
ファイル: oauth1a.go プロジェクト: laicosly/go-social
func NewConsumer(credentials *Credentials, authpoints *AuthPoints) *oauth.Consumer {

	return oauth.NewConsumer(
		credentials.ConsumerKey,
		credentials.ConsumerSecret,
		oauth.ServiceProvider{
			RequestTokenUrl:   authpoints.RequestToken,
			AuthorizeTokenUrl: authpoints.Authorize,
			AccessTokenUrl:    authpoints.AccessToken,
		})
}
コード例 #30
0
ファイル: oauth.go プロジェクト: LastZactionHero/TweetMachine
func newOauthConsumer() *oauth.Consumer {
	consumerKey := os.Getenv("TWITTER_CONSUMER_KEY")
	consumerSecret := os.Getenv("TWITTER_CONSUMER_SECRET")

	provider := 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",
	}
	return oauth.NewConsumer(consumerKey, consumerSecret, provider)
}