We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getting XSRF-TOKEN successfully but when i try to login it shows XSRF-TOKEN mismatch also it is working preety fine on browsers and postman**
`const app = require('../../../app.js'); const expect = require('chai').expect; const request = require('supertest'); var csrfToken;
describe('GET /api/csrf-token', () => { it('OK, Getting CSRF Token', (done) => { request(app).get('/api/csrf-token') .expect(200) .then((res) => { const body = res.body; csrfToken=body.csrfToken; expect(body).to.contain.property('csrfToken'); done(); }) .catch((err) => done(err)); }); });
describe('POST /api/users/login', () => { it('OK, Logging in with super admin crediantials', (done) => { request(app).post('/api/users/login') .set('Content-Type', 'application/json') .set("Accept","/") .set("XSRF-TOKEN",csrfToken) .set("Cookie","XSRF-TOKEN",csrfToken) .set("withCredentials",true) .expect(200) .send({"email":"super@abc.com","password":"abc"}) .expect((res) => { const body = res.body; console.log(body); expect(body.message).to.contain.property('Auth Successful'); expect(body).to.contain.property('token'); done(); }) .catch((err) => done(err)); }); }); `
Originally posted by @ahmadbingulzar in #32 (comment)
The text was updated successfully, but these errors were encountered:
Issue Resolved if someone facing the same issue feel free to contact at ahmadbingulzar@gmail.com
ahmadbingulzar@gmail.com
Sorry, something went wrong.
No branches or pull requests
getting XSRF-TOKEN successfully but when i try to login it shows XSRF-TOKEN mismatch also it is working preety fine on browsers and postman**
`const app = require('../../../app.js');
const expect = require('chai').expect;
const request = require('supertest');
var csrfToken;
describe('GET /api/csrf-token', () => {
it('OK, Getting CSRF Token', (done) => {
request(app).get('/api/csrf-token')
.expect(200)
.then((res) => {
const body = res.body;
csrfToken=body.csrfToken;
expect(body).to.contain.property('csrfToken');
done();
})
.catch((err) => done(err));
});
});
describe('POST /api/users/login', () => {
it('OK, Logging in with super admin crediantials', (done) => {
request(app).post('/api/users/login')
.set('Content-Type', 'application/json')
.set("Accept","/")
.set("XSRF-TOKEN",csrfToken)
.set("Cookie","XSRF-TOKEN",csrfToken)
.set("withCredentials",true)
.expect(200)
.send({"email":"super@abc.com","password":"abc"})
.expect((res) => {
const body = res.body;
console.log(body);
expect(body.message).to.contain.property('Auth Successful');
expect(body).to.contain.property('token');
done();
})
.catch((err) => done(err));
});
});
`
Originally posted by @ahmadbingulzar in #32 (comment)
The text was updated successfully, but these errors were encountered: