Skip to content

Commit

Permalink
Update code examples in building-a-login-with-github-button-with-a-gi…
Browse files Browse the repository at this point in the history
…thub-app.md (#35414)

Co-authored-by: Alex Nguyen <[email protected]>
  • Loading branch information
arthurgubaidullin and nguyenalex836 authored Dec 6, 2024
1 parent 6b12aa9 commit 8459115
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,10 @@ These steps lead you through writing code to generate a user access token. To sk
uri = URI("{% data variables.product.rest_url %}/user")

result = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
body = {"access_token" => token}.to_json

auth = "Bearer #{token}"
headers = {"Accept" => "application/json", "Content-Type" => "application/json", "Authorization" => auth}

http.send_request("GET", uri.path, body, headers)
http.send_request("GET", uri.path, nil, headers)
end

parse_response(result)
Expand Down Expand Up @@ -340,12 +338,10 @@ def user_info(token)
uri = URI("{% data variables.product.rest_url %}/user")

result = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
body = {"access_token" => token}.to_json

auth = "Bearer #{token}"
headers = {"Accept" => "application/json", "Content-Type" => "application/json", "Authorization" => auth}

http.send_request("GET", uri.path, body, headers)
http.send_request("GET", uri.path, nil, headers)
end

parse_response(result)
Expand Down

0 comments on commit 8459115

Please sign in to comment.