javascript - Prevent axios/fetch redirection -
i have little problem in app, have cookies given in response of 1 url, wich 1 obtained making request other url. request done, not able cookies because when reseult of request, redirected / of site. question : there way authorize first redirection , not second?
i precize using react-native, , axios solution (maxredirects: 1) not working in case. same "redirect: 'manual'" in fetch.
the request code:
fetch( 'https://gitlab.blablabla.fr/users/auth/ldapmain/callback' , { method: 'post', headers: { 'content-type': 'application/x-www-form-urlencoded', 'accept-charset':'utf-8', }, body: querystring.stringify({ authenticity_token: this.state.token, username: this.state.username, password: this.state.password, }), redirect: 'manual', credentials: 'include', withcredentials: 'true', } ).then( (responsedata2) => { console.log(this.state.username +"/"+ this.state.password+ "/"+this.state.token + "/"+ this.state.utf8); console.log(responsedata2); })
and response shown :
response { type: 'default', status: 200, ok: true, statustext: undefined, headers: headers { map: { 'x-version-id': [object], server: [object], 'cache-control': [object], date: [object], 'content-type': [object], 'content-length': [object], 'content-security-policy': [object], 'accept-ranges': [object], 'x-request-id': [object], 'last-modified': [object], 'x-frame-options': [object] } }, url: 'https://mattermost.blablabla.fr/', _bodyinit: '<!doctype html> <html> html code</html> ', _bodytext: '<!doctype html> <html> html code</html> ' }
Comments
Post a Comment