title: How to return RSA key in jwks_uri endpoint for OpenID Connect Discovery
body: <p>Working on the discovery part of an OpenID Connect provider, I'm a bit confused about how to properly return my <em>public</em> <em>keys</em>. My problem is specifically with the <code>modulus (n)</code> and the <code>exponent (e)</code> values.</p>
  
  <p>The initial values of both are:</p>
  
  <pre><code>n = 124692971944797177402996703053303877641609106436730124136075828918287037758927191447826707233876916396730936365584704201525802806009892366608834910101419219957891196104538322266555160652329444921468362525907130134965311064068870381940624996449410632960760491317833379253431879193412822078872504618021680609253
  
  e = 65537
  </code></pre>
  
  <p>So, what I understand reading <a href="http://self-issued.info/docs/draft-jones-json-web-key-00.html#anchor8" rel="nofollow">here</a>, just need to base64url encode both.</p>
  
  <p><em>(Example in Python)</em></p>
  
  <pre><code>n = urlsafe_b64encode(str(n))
  e = urlsafe_b64encode(str(e))
  
  n = "MTI0NjkyOTcxOTQ0Nzk3MTc3NDAyOTk2NzAzMDUzMzAzODc3NjQxNjA5MTA2NDM2NzMwMTI0MTM2MDc1ODI4OTE4Mjg3MDM3NzU4OTI3MTkxNDQ3ODI2NzA3MjMzODc2OTE2Mzk2NzMwOTM2MzY1NTg0NzA0MjAxNTI1ODAyODA2MDA5ODkyMzY2NjA4ODM0OTEwMTAxNDE5MjE5OTU3ODkxMTk2MTA0NTM4MzIyMjY2NTU1MTYwNjUyMzI5NDQ0OTIxNDY4MzYyNTI1OTA3MTMwMTM0OTY1MzExMDY0MDY4ODcwMzgxOTQwNjI0OTk2NDQ5NDEwNjMyOTYwNzYwNDkxMzE3ODMzMzc5MjUzNDMxODc5MTkzNDEyODIyMDc4ODcyNTA0NjE4MDIxNjgwNjA5MjUz"
  e = "NjU1Mzc="
  </code></pre>
  
  <p>In what am I wrong? Because, for example, <a href="https://www.googleapis.com/oauth2/v3/certs" rel="nofollow">google keys</a> have a different encoding.</p>
  
  <p><em>(Google key values)</em></p>
  
  <pre><code>n = "rl1iVsRbhod-gDJj2SDs94lk5iY0QYXV5HIPtjcx4KmIlmq-cdmfLteTeIHFsO5c6hKUt8R3uZzaQNgF3fKt700fT4m6tU23qK4EoLlx9Z_uSajtpMajdmX_FOdyHyQgcn0tj3YqPeYCOTBhRVNoLIenf9vy0hfFy71lcPhylnE",
  e = "AQAB"
  </code></pre>
  
  <p>Am I missing something? Thanks for your time.</p>
  
  <p><em>PD: <a href="https://github.com/juanifioren/django-oidc-provider" rel="nofollow">The project I'm working on</a>.</em></p>