title: How to authenticate to the Confluence rest api using Atlassian jwt token in ruby
body: <p>I am trying to make api calls to Confluence cloud by authenticating with jwt. In my descriptor file, I have opted for the <em>read</em> scope.</p>
  <p>I am following this <a href="https://bitbucket.org/atlassian/atlassian-jwt-ruby/src/master/" rel="nofollow noreferrer">guide</a> on how to generate the jwt token. In my code base, I have</p>
  <pre><code>require 'atlassian/jwt'
  require 'json'
  require 'httparty'
  
  url = &quot;https://my-domain.atlassian.net/wiki/rest/api/space/space_key&quot;
  issuer = 'my_issuer'
  http_method = 'get'
  shared_secret = 'shared_secret'
  
  claim = Atlassian::Jwt.build_claims(issuer, url, http_method)
  jwt = JWT.encode(claim, shared_secret)
  
  response = HTTParty.get(&quot;https://my-domain.atlassian.net/wiki/rest/api/space/space_key&quot;, :headers =&gt; {'Content-Type' =&gt; 'application/json', authorization: jwt})
  puts response
  </code></pre>