Home > Back-end > Spring cloud vue each request do not match the session
Spring cloud vue each request do not match the session
Time:11-26
Recent projects need when login to add captcha images, then online literally sought a generated authentication code, the method of interface test is no problem, but when docking with the front end, each request to the session inconsistent problems, later found the solution: The front plus: Axios. Defaults. WithCredentials=true; Backend and cross-domain configuration (plus the gateway layer) : Private CorsConfiguration CorsConfiguration () { CorsConfiguration CorsConfiguration=new CorsConfiguration (); CorsConfiguration. AddAllowedOrigin (" * "); CorsConfiguration. AddAllowedHeader (" * "); CorsConfiguration. AddAllowedMethod (" * "); CorsConfiguration. SetAllowCredentials (true); Return corsConfiguration; }
Key: the vue front don't in the local test, must be put in the server to above, or will the session, remember to keep in mind, this is my on the crater.
CodePudding user response:
Can be placed in the local test
CodePudding user response:
Logic is not right, Should avoid to use the Session, Issued by the authentication code, at the same time issued a corresponding Token, Front end when submit verification code, submitted at the same time corresponding Token, back-end according to Token to obtain corresponding server authentication code, compared with the authentication code of the front
CodePudding user response:
Test the server every time very troublesome, it is best to front-end developer also installing eclipse, synchronous back-end code, compile restart Tomcat, The front end can realize local development testing