Skip to content

Instantly share code, notes, and snippets.

@Jzarecta
Created December 4, 2014 19:58
Show Gist options
  • Save Jzarecta/69467e5e0a3f25731c27 to your computer and use it in GitHub Desktop.
Save Jzarecta/69467e5e0a3f25731c27 to your computer and use it in GitHub Desktop.
URL targetUrl = new URL(targetURL);
HttpURLConnection httpConnection = (HttpURLConnection) targetUrl.openConnection();
httpConnection.setDoOutput(true);
httpConnection.setRequestMethod("POST");
httpConnection.setRequestProperty("Content-Type", "application/json");
String input = "{\"action\":\"authenticate\",\"public-key\":\"\",\"user-key\":\"\"}";
OutputStream outputStream = httpConnection.getOutputStream();
outputStream.write(input.getBytes());
outputStream.flush();
@Jzarecta
Copy link
Author

Jzarecta commented Dec 7, 2014

func (t Tok3nInstance) ValidateAuth(userkey, sqr, sesion string) (string,error) {
    u, _ := url.Parse("/api/v2/validate?")
    q := u.Query()
    q.Set("secret_key", t.Config.SecretKey)
    q.Set("sqr", sqr)
    q.Set("user_key", userkey)
    q.Set("secion",sesion)
    u.RawQuery = q.Encode()
    u.String()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment