Exemplo n.º 1
0
// build the message to sign/digest
func BuildMessage(url string, params map[string]string) string {
	i := 0;
	keys := make([]string,len(params));
	for k,_ := range params {
		keys[i] = k;
		i = i + 1;
	}
	sort.SortStrings(keys);

	j := 0;
	mss := make([]string,len(params));
	for k := range keys {
		mss[j] = urllib.Urlquote(keys[k]) + "=" + urllib.Urlquote(params[keys[k]]);
		j = j + 1;
	}
	ms := strings.Join(mss, "&");
	log.Stderrf("ms:%s", ms);

	m := strings.Join([]string{"GET", urllib.Urlquote(url), urllib.Urlquote(ms)}, "&");
	log.Stderrf("m:%s", m);

	return m;
}
Exemplo n.º 2
0
func (c *AuthClient) GetAuthorizationUrl(callback_url string) string {
	token := c.get_auth_token(callback_url);
	log.Stderrf("get_authorization_url:token:%s:secret:%s", token.Id, token.Data["secret"]);
	return c.authorization_url + "?oauth_token=" + token.Id + "&oauth_callback=" + urllib.Urlquote(callback_url);
}