I'm using EVE Online's OAUTH as a testbed (mainly because I know what all the responses will mean from my time working at CCP).
Fair note: I'm not a programmer/coder, and this was my FIRST EVER attempt at generating a script. Took about an hour to get it to validate and save, but I DID get that far!
Here is what I've got so far:
- Published a public creator page with a button that triggers the login and initial authorization
- Redirects to a published creator form that catches the return values
- authorization_code is being caught in the form (obviously, not submitting the form as its being utilized as a placeholder)
- Haven't figured out how to call for the refresh token afterwards, or map it into a field.
My first non-copied Deluge Script
- // DECLARATIONS //
- // Combined Header //
- // Header Map.. just in case//
- // ===============================//
- // header = Map();
- // header.put("Authorization", "URL safe Base64(cd80510c71594a588677b599a2473b70:Qvu4b1aNTJ1QcjVq8IcYUY44hL7q1U5fZgDNbpC5)");
- // header.put("Content-Type", "application/x-www-form-urlencoded");
- // header.put("Host", "login.eveonline.com");
- //
- //=====Creator EVE Parameters=====//
- //
- input.redirect_uri = "https://creator.zohopublic.com/zenbros/eve-corp-manager/page-perma/EVE_OAUTH_PAGE/jVvXTPBAv3egOMrXztneGNxZCHDfDM7COebh4jSPxNRF9qZFuFrO3YvDbnCRww30tn276gba1vtQxbhJzhszTtUxjPgE0MkVZw63";
- state = "testing";
- scope = input.scope_values;
- grantType = "authorization_code";
- // EVE Headers //
- head = {"Authorization":"cd80510c71594a588677b599a2473b70:Qvu4b1aNTJ1QcjVq8IcYUY44hL7q1U5fZgDNbpC5)","Content-Type":"application/x-www-form-urlencoded","Host":"login.eveonline.com"};
- //
- // =============EVE URLs============= //
- //
- // Start encode AUTH URL //
- authMap = Map();
- authMap.put("authURL","https://login.eveonline.com/v2/oauth/authorize/");
- authMap.put("response_type","code");
- authMap.put("redirect_uri",input.redirect_uri);
- authMap.put("client_id",input.client_id);
- authMap.put("scope",scope);
- authMap.put("state",state);
- authStr = authMap.toString();
- authEnc = encodeURL(authStr);
- //
- // End Create encoded AUTH URL //
- //
- // Start encode TOKEN URL //
- tokenMap = Map();
- tokenMap.put("tokenURL","https://login.eveonline.com/v2/oauth/token");
- tokenMap.put("grant_type",grantType);
- tokenMap.put("Authorization: ",head);
- tokenStr = tokenMap.toString();
- tokenEnc = encodeURL(tokenStr);
- //End Encode TOKEN URL //
- refURL = Map();
- refURL.put("refLink","https://login.eveonline.com/v2/oauth/authorize?");
- refURL.put("response_type","code");
- refURL.put("code",input.code);
- refURL.put("redirect_uri",input.redirect_uri);
- refURL.put("client_id",input.client_id);
- refURL.put("scope",input.scope_field);
- refURL.put("state",state);
- refMap = Map();
- refMap.put(refURL);
- refStr = refMap.toString();
- refreshURL = encodeURL(refStr);
- // - Creator Response Mapping - //
- // Authorization //
- requestAuth = getURL(authEnc);
- authMap = requestAuth.toMap();
- // Request Authorization Code //
- requestCode = getURL(tokenEnc);
- codeMap = requestCode.toMap();
- getCode = codeMap.get("code");
- input.code = getCode;
- // Request Refresh //
- requestRefresh = getUrl(refreshURL);
- requestMap = requestRefresh.toMap();
- getRefreshToken = requestMap.get("refresh_token");
- input.refresh_token = getRefreshToken;
- // End OAUTH //
Challenges/Goals/Requests/"HELP!!!"
- Would really help if there was a fully explained, step-by-step example of how to implement OAUTH 2.0 interchange between Creator and an external service.
- Goal: Learn OAUTH 2.0 capabilities available within Creator, using Deluge, for integration with other 3rd party CRMs (Hubspot & Infusionsoft for example)
- Infusionsoft if my primary need. If anyone feels like being SUPER HELPFUL, I've linked their API and OAUTH documentation:
- Or, if using my EVE Online example code is easier, here are their docs
- Absolute end-goal
- Successful OAUTH 2.0 interchange, catching the refresh_token, and updating the refresh token every 21 hours.
Thanks to anyone who provides any insight!