Skip to content

Instantly share code, notes, and snippets.

@ajwaxman
Created August 10, 2013 19:36
Show Gist options
  • Save ajwaxman/6201837 to your computer and use it in GitHub Desktop.
Save ajwaxman/6201837 to your computer and use it in GitHub Desktop.
jawbone auth
code = params["code"]
json = HTTParty.post("https://jawbone.com/auth/oauth2/token", body: {client_id: ENV["JAWBONE_CLIENT_ID"], client_secret: ENV["JAWBONE_CLIENT_SECRET"], grant_type: 'authorization_code', code: code }).body
result = JSON.parse(json)
access_token = "Bearer " + result["access_token"]
@user = HTTParty.get("https://jawbone.com/nudge/api/users/@me", :headers => { "Authorization" => access_token })["data"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment