JWT-Based Client Authentication - StatusCode: MethodNotAllowed

43 views
Skip to first unread message

Arthur Didion

unread,
Oct 27, 2020, 4:44:40 PM10/27/20
to UDAP
I'm trying to authenticate using client_credentials.  First I run my code to do DCR and successfully get a client_id.  Next I build a GET URI as outlined in UDAP JWT-BASED CLIENT AUTHENTICATION 3.1.  Using the token endpoint.

Here is my sample code:  
            string testparams = $"response_type=Code&state=client_random_state&client_id={udapToken.ClientId}&scope=*/*&redirect_uri=https://httpbin.org/anything";

            var tokenUrl = $"https://test.udap.org/oauth/stage/token?{testparams}";

            var client2 = new RestClient($"tokenUrl");

            client2.Timeout = -1;

            var request2 = new RestRequest(Method.GET);

            request2.AddHeader("response_type", "code");
            request2.AddHeader("accept", "*/*");

            IRestResponse response2 = client2.Execute(request2);

Here is my response2:
"StatusCode: MethodNotAllowed, Content-Type: text/html, Content-Length: 1062)"

I'm not sure why I'm getting this error.  What am I doing wrong?

Thanks,  Art...

UDAP Test Tool Team

unread,
Oct 27, 2020, 5:19:13 PM10/27/20
to udap-d...@googlegroups.com
Hi Art, sections 3.1 and 5.1 of UDAP JWT-based Client Auth are only for apps using authorization code flow. For client credentials, please refer to sections 3.2 and 5.2 instead. The token endpoint only accepts POST requests (not GET) as per the example in section 5.2.
Reply all
Reply to author
Forward
0 new messages