Example #1
0
func TestGoogle(t *testing.T) {
	goauth.Verbose = true
	g := goauth.NewClient("anonymous", "anonymous", GOOGLE)
	g.Scope = "https://www.google.com/base/feeds/"
	g.RequestMethod = "GET"
	_, tc, err := g.GetAuthorizeURL("http://googlecodesamples.com/oauth_playground/index.php")
	if err != nil || tc.OAuthToken == "" {
		t.Errorf("OAuthToken shouldn't be empty %+v", tc)
	}
}
Example #2
0
func (up *st) OAuthClient(env Env) (c *goauth.Client) {
	cc := getClientKeyMap()

	c = goauth.NewClient(cc["weibo"].Key, cc["weibo"].Secret, &goauth.Configuration{
		RequestTokenURL:        "http://api.t.sina.com.cn/oauth/request_token",
		AccessTokenURL:         "http://api.t.sina.com.cn/oauth/access_token",
		AuthorizeURL:           "http://api.t.sina.com.cn/oauth/authorize",
		UseAuthorizationHeader: true,
		UseBodyHash:            true,
		UserIdKey:              "user_id",
	})
	return
}