1

I am using following code but it's giving 401 unauthorized.I need the solution to be fully automated(no user intervention after start) so I have to use basic authentication meaning no outh.

import com.google.api.client.http.BasicAuthentication;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson.JacksonFactory;
import com.google.api.services.tasks.Tasks;
import com.google.api.services.tasks.model.Task;


HttpTransport httpTransport = new NetHttpTransport();
JacksonFactory jsonFactory = new JacksonFactory();
BasicAuthentication authentication = new BasicAuthentication("zzzzzz@gmail.com","zzzzzz");

Tasks service = new Tasks(httpTransport, jsonFactory, authentication);
Task task = new Task();
task.setTitle("Publish blog post");
service.tasks().insert("list-id", task).execute();

please help me solve this.Thanks

Mat
  • 202,337
  • 40
  • 393
  • 406
vishesh
  • 2,007
  • 6
  • 32
  • 67

0 Answers0