Skip to content

Instantly share code, notes, and snippets.

@cyantarek
Created February 6, 2019 12:25
Show Gist options
  • Save cyantarek/23ce9ee8136831baf7fa2014db65688c to your computer and use it in GitHub Desktop.
Save cyantarek/23ce9ee8136831baf7fa2014db65688c to your computer and use it in GitHub Desktop.
http.HandleFunc("/credentials", func(w http.ResponseWriter, r *http.Request) {
clientId := uuid.New().String()[:8]
clientSecret := uuid.New().String()[:8]
err := clientStore.Set(clientId, &models.Client{
ID: clientId,
Secret: clientSecret,
Domain: "http://localhost:9094",
})
if err != nil {
fmt.Println(err.Error())
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]string{"CLIENT_ID": clientId, "CLIENT_SECRET": clientSecret})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment