Dealing with browser history after payment gateway checkout - javascript

In web app i'm redirecting my user to payment gateway's URL to complete the transaction.
After successful payment user will be redirected back to my web app.
Problem is, if user hits browser back button he/she will again go back to payment gateway's URL which will redirect the user back to my web app with stale payment status.
Yes i can handle stale payment status in backend, but how do we handle browser history?
When user lands in the web app's payment status page can i somehow delete the browser history paths related to payment gateway's URLs?

Try this from preventing user to go back https://www.aspsnippets.com/Articles/Disable-Browser-Back-Button-Functionality-using-JavaScript.aspx
This is pretty dramatic behavior, and not a very friendly one for the user...
Another solution is to recognize when user is getting out of your page via onbeforeunload confirm() on window.onbeforeunload
inform that he is getting out if the payment method, via prompt() https://www.w3schools.com/jsref/met_win_prompt.asp

Related

Delete User session of Azure ADB2C using MSAL

I have integrated Azure ADB2C in React SPA, using MSAL package. Both login and logout is working fine. My requirement is, After user successfully changes the password in Azure ADB2C update password page I am redirecting user to confirmation page stating that they have successfully changed the password and displayed a "Continue" button on click of that, the user will be made to signed out of the application.
The above scenario works fine, but if the user without clicking the "Continue" button, clicks on the browser back button, the user can visit the authenticated pages and the user is still authorized to visit the pages. But instead I want the user to get logged off from the application.
Is there any way in Azure ADB2C to delete the active user session alternatively without triggering the button.
While clicking on the button am calling Signout policy already defined.

get query params after payment in another origin pwa (safari)

I have a pwa app. in this app we have an account charge feature. the server gives us a pay link which is an external link. after we open it and user goes through payment(IPG) and after successful payment he will get redirected to a page in our site. in that page we have a "back to application" button with some query params which includes some information about payment.
The question is how can i get the query params in another origin when user gets back to my app in order to find out whether the payment was successful or not?
we have a standalone pwa and i want to open the pwa app when user wants to get back to app after payment and not opening another instance of safari.

microsoft graph api. automatic login after user is logged out problem

I have succesfully setup a NodeJS web application that uses the Microsoft Graph API. There is only one silly problem.
So if a user wants to use the application, he has to log in first. Thats why the first page of my app is the authentication url of the Microsoft API. After the user has succesfully logged in, he is send to the homepage. Now when the user clicks on logout button, problems begin to appear.
As I have said earlier, the first page of the app is the auth url from Microsoft API. When the user logs out he is send back to that same url, because he is not logged in anymore. While he is being send to the login url, microsoft automatically logs the user back in.
So my question is, is there a way the user isn't logged in autmatically after he signed out?
I know this has to do with the cookies from login.live.com. Because if I delete them I have to mannually sign in again.
The solution is to use prompt parameter. docs.

How Messenger.com & Facebook.com share login / user data?

I recently had a use-case of sharing login / user data between two different domains without doing SSO or extra-login-step.
I want user to login on app-a.com, when he goes to app-b.com, it will auto-login without any action or at least show him his data to login in one click.
When you are logged-in on facebook.com and go to messenger.com for the first time, that is actually what happens.
How do facebook.com and messenger.com share login / user data?
I first thought it was an Iframe, but there's no iframe in the page when I check with the Chrome Cosole.
I also checked the AJAX requests but nothing readable there.
How do they do this?

Notify user to login on clear the browser cache

Hi
I am working on a web-application which deals which jQuery,Javascript,Html as a part of UI.
we have login authentication which will ask for username and password.so my question is how to notify the user automatically to login into my application, when user will clear the cache.
for example: do login into facebook. after login clear the cache of browser. instantly you will get a notification to login again. please help me out.
Save login information in a cookie. When it's no longer present - redirect user to your login page.

Categories