Thank you for the response Leo.

 

I was able to get it working by excluding the authorization header and call like so:

 

POST to https://auth.peeringdb.com/oauth2/token/

Header: 'Content-Type': 'application/x-www-form-urlencoded'

Body: 'grant_type=authorization_code&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&code=CODE&redirect_uri=CALLBACK_URI'

 

It seems the system does not like the Basic auth header, nor does it like JSON as the request body.

 

Hopefully this helps someone in the future.

 

Thanks,

Justin

 

 

From: Leo Vegoda <leo@peeringdb.com>
Sent: Wednesday, February 22, 2023 11:01 AM
To: Justin Cole <justinc@redapt.com>
Subject: Re: [PDB Tech] OAuth client application help requested - cannot authorize with client secret

 

Hi Justin,

 

2.44.0 was just deployed to production. It included a fix for OAuth logins that failed when MFA was enabled. It’s possible that this has resolved your issue. If not, please let us know.

 

favicon.ico

 

Kind regards,

 

Leo Vegoda

PeeringDB Product Manager



On Feb 15, 2023, at 19:52, Justin Cole <justinc@redapt.com> wrote:

 

Hello,

 

I’m hoping someone can help me with my OAuth application problem. 

 

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: { "meta": { "error": "Invalid username or password" } }

 

Call to /token/ looks like:

 

Header:

Authorization: Basic (Base64Encode(CLIENT_ID:CLIENT_SECRET))

Body:

{ 

grant_type:'authorization_code',

code:'CODE',

client_id:'CLIENT_ID',

client_secret:'CLIENT_SECRET'

}

 

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 (https://www.peeringdb.com/oauth2/applications/register/) are correct.

 

What am I doing wrong?  

 

Or is there something I am missing to enable the OAuth application registration from working properly?

 

Thank you,

Justin

 

 

 

_______________________________________________
Pdb-tech mailing list
Pdb-tech@lists.peeringdb.com
https://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech