• Gabriel E Casarsa
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hello everyone.
I have a requirement that asks me to backup the documents in Salesforce in Google Drive.
I have already managed to connect and load the documents, but I need to automate this process, logging into Google automatically without the screen in which I request the credentials.
I do not have much experience in web services, so I do not know if I'm doing the order right to the server.
HttpRequest req = new HttpRequest();
            req.setMethod('POST');
            req.setEndpoint('https://accounts.google.com/o/oauth2/token');
            req.setHeader('content-type', 'application/x-www-form-urlencoded');
            String messageBody = 'code='+code+'&client_id='+key+'&client_secret='+secret+'&redirect_uri='+redirect_uri+'&grant_type=authorization_code';
            
            req.setHeader('Content-length', String.valueOf(messageBody.length()));
            req.setBody(messageBody);
            req.setTimeout(60*1000);
            Http h = new Http();
            String resp;
            HttpResponse res = h.send(req);
            resp = res.getBody();

Is there a way to pass the email and password in the body of the request to log in?

Greetings thank you!
Hello everyone.
I have a requirement to store information from different Contacts in Google Drive. My problem is that I would like to create a directory dynamically for each new contact and I have not found much information on how to do it from apex. Has anyone had success performing this functionality?

Greetings thank you!
Hello everyone.
I have a requirement to store information from different Contacts in Google Drive. My problem is that I would like to create a directory dynamically for each new contact and I have not found much information on how to do it from apex. Has anyone had success performing this functionality?

Greetings thank you!