<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.hljs-attr
{mso-style-name:hljs-attr;}
span.hljs-string
{mso-style-name:hljs-string;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m hoping someone can help me with my OAuth application problem.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I have created an OAuth application with authorization-code grant type and entered my redirect uri. I can successfully call the /authorize/ endpoint, log in and receive an authorization code. However, the subsequent callback to /token/
always returns 401 Unauthorized with response body: <span style="font-size:10.0pt;font-family:Consolas;color:#444444;background:#F0F0F0">
{ </span><span class="hljs-attr"><span style="font-size:10.0pt;font-family:Consolas;color:#444444">"meta"</span></span><span style="font-size:10.0pt;font-family:Consolas;color:#444444;background:#F0F0F0">: {
</span><span class="hljs-attr"><span style="font-size:10.0pt;font-family:Consolas;color:#444444">"error"</span></span><span style="font-size:10.0pt;font-family:Consolas;color:#444444;background:#F0F0F0">:
</span><span class="hljs-string"><span style="font-size:10.0pt;font-family:Consolas;color:#880000">"Invalid username or password"</span></span><span style="font-size:10.0pt;font-family:Consolas;color:#444444;background:#F0F0F0"> } }<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Call to /token/ looks like:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">POST to <a href="https://auth.peeringdb.com/oauth2/token/">https://auth.peeringdb.com/oauth2/token/</a><o:p></o:p></p>
<p class="MsoNormal">Header:<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:.5in">Authorization: Basic (Base64Encode(CLIENT_ID:CLIENT_SECRET))<o:p></o:p></p>
<p class="MsoNormal">Body:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">{ <o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in;text-indent:.5in">grant_type:'authorization_code',<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in;text-indent:.5in">code:'CODE',<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in;text-indent:.5in">redirect_uri:'https://localhost:3001/api/auth/callback/peeringdb',<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in;text-indent:.5in">client_id:'CLIENT_ID',<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in;text-indent:.5in">client_secret:'CLIENT_SECRET'<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’ve determined that problem is the Authorization header value, however I’ve verified the values match the client id/client secret generated from PeeringDB (<a href="https://www.peeringdb.com/oauth2/applications/register/">https://www.peeringdb.com/oauth2/applications/register/</a>)
are correct.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What am I doing wrong? <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Or is there something I am missing to enable the OAuth application registration from working properly?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you,<o:p></o:p></p>
<p class="MsoNormal">Justin<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>