You need to jump to the login authorization page before performing method A (such as favorites). How to call back method An after login?

  1. now you want to execute a method (or function), but you need to jump to the login page, but how can you continue to execute that method after logging in?
Dec.25,2021

the usual practice is to jump to login with a parameter on the url to indicate the page of the previous step, so that after the login is complete, check that if there is this parameter, jump back to the original page. Of course, there are other ways, and this is just one of them.


< H2 > function, if it is fn call: < / H2 >
  • if it is a front-end sharing project such as React or Vue, the method can be written on redux or vuex, separated from the business components, and cross-page calls will not affect
  • if it is not the first one, you can write a method. In the js file, the outer link is introduced, and the method can be called after login.

or take a logo upstairs to determine whether or not to call this method. I hope it will help you!


has done something similar.
individuals are not recommended to do this unless they have to.
assume that there are other similar functions that require login, one or two are fine, and in more than a dozen words, the login page is a little overloaded.
1. Jump to the login page URL with the parameters to be operated and the address of the current page,
2. The login page checks the pagefrom parameter,
3. If it is a favorite function, then log in and execute the relevant function (parameters have been brought in). After execution, jump back to url of pagefrom .
suggestion: just jump back to the original favorites page after login.


the parameters and the current url are assembled into a parameter like redirect_url, so it is easy to jump to this page after logging in, and then execute the previous favorite methods according to the parameters!


make a tag in the method, and then put the method name in the url when you jump. After the jump, parse the url, and execute the corresponding method from the location of the tag. This operation is a bit unreasonable


write a session or cookie or url with callback


bring the callback data with you when you enter the authorization page. Put the callback where the authorization is completed


1) put the returned address on the parameter, log in to determine whether there are callback parameters, and jump directly if so!

Menu