SHARE
TWEET

Untitled

a guest Apr 27th, 2018 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2. "access_token":"e...2",
  3. "instance_url":"http://m.../..c"
  4. }
  5.    
  6. def http = new HTTPBuilder(sf_login_domain)
  7.     def postBody = [
  8.         grant_type: 'password',
  9.         client_id: consumer_key,
  10.         client_secret: consumer_secret,
  11.         username: auth_username,
  12.         password: auth_password
  13.     ]
  14.     try {
  15.         http.post( path : 'EfetuarLogin', body : postBody, requestContentType: URLENC) {
  16.           resp, json ->
  17.             log.debug "**  access_token: ${json.access_token}, instance_domain: ${json.instance_url}"
  18.             access_token = json.access_token
  19.             instance_domain = json.instance_url + "/"
  20.         }
  21.         coss.Parametro.executeUpdate("update Parametro p set p.valor='$access_token' where p.chave='ACCESS_TOKEN_SALES_FORCE'")
  22.         coss.Parametro.executeUpdate("update Parametro p set p.valor='$instance_domain' where p.chave='INSTANCE_DOMAIN_SALES_FORCE'")
  23.         retornoLogin = ['access_token':access_token, 'instance_domain':instance_domain]
  24.     }
  25.     catch(Exception e){
  26.         log.error "** Error code: ${e}"
  27.         log.error "** Post form: ${postBody}"
  28.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top