public AccessTokenResult getAccessToken(String code)
    {
        String respStr = getAccessTokenStr(RENREN_ACCESS_TOKEN_URL, code);
        if (logger.isDebugEnabled()) {
            logger.debug("accesstokenstr:" + respStr);
        }
        AccessTokenResult result = new AccessTokenResult();
        if (respStr == null || "".equals(respStr)) {
        	result.setRv(ERROR_NETWORK_CALL);
        	return result;
        }
        
        Object obj = JSON.parse(respStr);
		JSONObject msg = (JSONObject)obj;
        
		
		String error = msg.getString("error");
        if (error != null) {
            result.setRv(1);
            result.setErrmsg(msg.getString("error_description"));
        } else {
            result.setRv(ERROR_SUCCESS);
            result.setAccessToken(msg.getString("access_token"));
            long now = new Date().getTime();
            result.setLoginTime(now);
            result.setExpireTime(now + msg.getLong("expires_in") - 600);
            this.accessToken = msg.getString("access_token");

            JSONObject user = msg.getJSONObject("user");//.user;
            if (user != null) {
            	this.nickname = user.getString("name");
                this.uid = user.getString("id");
                JSONArray avatars = user.getJSONArray("avatar");
                if (avatars != null && avatars.size() > 1) {
                	JSONObject avatarsObj = (JSONObject)avatars.get(1);
                	if (avatarsObj != null) {
                		this.avatar = avatarsObj.getString("url");
                	}                	
                }
                
            }
            
        }
        return result;
    }