coding1223322
coding1223322

Reputation: 473

oAuth returning 400 bad request

I am making a request to my auth server using the example from cypress documentation below.

https://github.com/cypress-io/cypress-example-recipes/blob/aa434ffc29946d545daf4c94019f9692eb0db3e0/examples/logging-in__single-sign-on/cypress/integration/logging-in-single-sign-on-spec.js#L47

Following is my configuration but I am getting a 400 bad request. The url should take me to the login form and authorise the user and then redirect to call back page to get the token.

Am i missing something?

const options = {
    method: 'POST',
    url: 'https://fakeauthserver.net/Account/Login',
    qs: {
        redirect_uri: 'http://localhost:9000/login/callback',
        client_id: 'webapp',
        response_type: 'code',
        scope: 'full-access'
    },
    form: true,
    body: {
        Username: '[email protected]',
        Password: '123456',
        button: 'login'
    }
};

_.extend(config);

cy.request(config)

Upvotes: 0

Views: 7745

Answers (1)

RrR-
RrR-

Reputation: 1410

Usually, the 400 Bad Request error occurs when you have made an error in the parameters sent in the request. Check whether you have sent all the parameters and whether they are the same as the ones registered in your identity provider.

Also, it might be due to POST request you have made here. According to the OAuth specification, authorization request should be a GET request.

Upvotes: 2

Related Questions