Skip to content

Instantly share code, notes, and snippets.

@WideWord
Created August 21, 2014 17:29
Show Gist options
  • Select an option

  • Save WideWord/e6ae2c839bf425a3926e to your computer and use it in GitHub Desktop.

Select an option

Save WideWord/e6ae2c839bf425a3926e to your computer and use it in GitHub Desktop.
func AuthAppVk(id, secret string) (auth VkAuth, err error) {
auth = VkAuth("")
url := fmt.Sprintf("https://oauth.vk.com/access_token?client_id=%s&client_secret=%secret&v=5.24&grant_type=client_credentials")
resp, err := http.Get(url)
if err != nil { return }
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil { return }
return VkAuth(fmt.Sprintf("%s", body)), nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment