Home > front end >  Consult! How do you make account login not expired front end
Consult! How do you make account login not expired front end

Time:12-13

Set up 30 minutes after the end, account login is outdated, say now to the login page for a long time, don't expire login, my side front how to run it, I don't understand this principle

CodePudding user response:

I only set up the operation will not expire, is in a fog out, if the user is not operating, 30 minutes will be expired, how do I let him not expired

CodePudding user response:

Front end what all need not stem, let every time the backend access interface, the expiration time in the redis update can be

CodePudding user response:

In general the back-end failure time each time the state of the need to log in to set the interface request will update the expiry time, so the front as long as the judge when expiring sends a request to this backend will update the expiration time again for half an hour

CodePudding user response:

Specific idea is to intercept the ajax request, set a delay timer, every request to remove the reset, the content of the decelerator is to send a request to update the expiration time

CodePudding user response:

This pot to jilt to the back-end, because every time you request to the backend token, expired, you can't pull the data, so you still need to log back in,

CodePudding user response:

The refresh token, expiring, to refresh the excuse to request a new token

CodePudding user response:

Depends on what you are overdue mechanism, if the auth, that is the refresh token, it is a set of standard processes, you baidu "auth2 refresh token" a pile of plan, if it is a more traditional cookie mechanism, you baidu "cookie refresh to keep expired"

CodePudding user response:

Overdue as required, such as must have an expiration date

CodePudding user response:

Let the back-end set the expiration time is long, or refresh every time to go, is the back-end control date

CodePudding user response:

Polling an ajax request, constantly refresh the server of the last access time

CodePudding user response:

references to the tenth floor r00_a2lBUR response:
polling ajax requests, constantly refresh the server of the last access time
polling is, I go and see

CodePudding user response:

reference 5 floor, open reply:
this pot to jilt to the back-end, because every time you request to the backend token, expired, you can't pull the data, so you still need to log back in,
yes, so now he wants me to help the user to refresh time, free to log in

CodePudding user response:

reference wind 灬, 4/f, cloud response:
specific idea is to intercept the ajax request, set a delay timer, every request to remove the reset, the content of the decelerator is to send a request to update the expiration time
oh oh, I also try this method, I added a xhrFields: {withCredentials: true}. This can also

CodePudding user response:

Can use axios intercept request, let the back-end put the head back to the token, you agreed that if the token expired will return a new to you, if no overdue will not be returned token in the head to you
You only need to intercept the request at this time, whether the header inside have token, so directly replace local token, so that can be done not expired

CodePudding user response:

On the 14th floor front end
reference _ rookie response:
axios request can be used to intercept, let the back-end put the head back to the token, you agreed that if the token expired will return a new to you, if no overdue will not be returned token in the head to you
You only need to intercept the request at this time, whether the header inside have token, so directly replace local token, so that you can do it don't expire
the idea is good, thank you

CodePudding user response:

Backend generally are, like you this backend set expiration time is after the pot, front end can do, or let the backend change time, or your request again refresh the expiration time

CodePudding user response:

Through the background to hold the front of cookies, set your time longer, such as 100
Log in again when the background by reading the content of the front-end cookies to implement login

But this need to be verified account
  • Related