auth0-spa-js icon indicating copy to clipboard operation
auth0-spa-js copied to clipboard

Add configuration option for custom transaction storage

Open mfrey43 opened this issue 1 year ago • 0 comments

Checklist

  • [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • [X] I have looked into the documentation and API documentation, and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

My Ionic app uses the Capacitor Browser extension as described in this official guide: https://auth0.com/docs/quickstart/native/ionic-angular/01-login

Sometimes after the login flow completes and the inAppBrowser closes, the callback handling fails with the error 'missing_transaction'. This is because the Android system has killed my app to free up memory while it was in the background. When the callback reopens the app the transaction data is lost because it was saved in SessionStorage. My problem is that I can't change the storage location to something that isn't wiped during a restart. I can only configure cookie or session storage.

Describe the ideal solution

I would like to set my own transactionStorage in the AuthorizationParams config object similar to how the cache configuration works. I already created a proof of concept in this commit: https://github.com/mfrey43/auth0-spa-js/commit/90da31095ed4c6d21166dd8d8956cffdd724862d

Alternatively, if I had the option to configure the transaction manager to use the cache for storage that would also work for me. I already configured the cache to use the device's native encrypted storage option.

Alternatives and current workarounds

No response

Additional context

I use this library directly without the auth0-angular wrapper because I needed more control.

mfrey43 avatar May 29 '24 16:05 mfrey43