Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OAuth 2.0 Token Endpoint clientId vs client_id

ANSWERED

I've been trying to add OAuth 2 authentication to my ASP.Net Core app and I've run into a problem with the token endpoint.

 

The ASP code is calling the TokenEndpoint and passing the client ID under the parameter client_id (which also matches the documentation here) The token endpoint is returning an error

 

{
    "errors": [
        {
            "errorType": "invalid_client",
            "message": "Invalid authorization header format. The header was not recognized to be a valid header for any of known implementations or a client_id was not specified in case of a public client Received header = null. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."
        }
    ],
    "success": false
}

The OAuth tutorial here though passes the client ID with the parameter name clientId, this seems to work when I've tried it in curl and it returns an access token.

 

I'm not sure if I don't anything wrong here but I don't know how to move forward from this?

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

I'm not sure what the problem was then. I found a Nuget package that implemented the Fitbit OAuth flow and that works so I don't know what it was. The package was this one https://www.nuget.org/packages/AspNet.Security.OAuth.Fitbit/

View best answer in original post

Best Answer
0 Votes
2 REPLIES 2

Hi @AJackson4,

 

Welcome to the Forums!

 

I'm sorry to hear that you are running into this error, and I'll be happy to investigate.

 

Can you please PM your complete POST request (like the example below)? I need to be able to see your headers, body, and endpoint.

 

In the meantime, I've done some light testing in the OAuth 2.0 tutorial and replaced the "clientID" with "client_id" and was still able to receive a token in return, so I am assuming it might be something else in your request that is causing this error.

curl	-X POST -i 
-H 'Authorization: Basic [Redacted]'
-H 'Content-Type: application/x-www-form-urlencoded' 
-d "client_id=[Redacted]" 
-d "grant_type=authorization_code" 
-d "redirect_uri=[Redacted]" 
-d "code=123ABC" 
https://api.fitbit.com/oauth2/token

I hope to hear from you! Let me know if you have any questions in the meantime.

Best Answer
0 Votes

I'm not sure what the problem was then. I found a Nuget package that implemented the Fitbit OAuth flow and that works so I don't know what it was. The package was this one https://www.nuget.org/packages/AspNet.Security.OAuth.Fitbit/

Best Answer
0 Votes