Open ms-emp opened 2 months ago
Already supported : https://github.com/Badisi/auth-js/blob/main/projects/auth-js/oidc/mobile/mobile-storage.ts#L27
As long as you have the package installed, the library will use it 😉
@ms-emp, did it worked ?
Hi @Badisi
The library looks for this specific plugin, my question is if we can provide a different secure plugin or use a custom implementation for saving/retrieving the tokens.
Sorry I misread the name of the plugin you mentioned as it's quite similar with capacitor-secure-storage-plugin
.
So you can provide your own implementation, either:
import { InMemoryWebStorage, WebStorageStateStore } from 'oidc-client-ts';
import { AuthUtils } from '@badisi/auth-js'; // or '@badisi/ngx-auth'
initAuth({ ..., internal: { userStore: new WebStorageStateStore({ store: AuthUtils.isNativeMobile() ? new MyMobileStorage() : new InMemoryWebStorage() // or simply "store: new MyMobileStorage()" if you are only developing for mobile }) } }
2. By overriding one of the reference the library is using:
```ts
// Example
window.Capacitor.Plugins.SecureStoragePlugin = new MyMobileStorage()
And in your case maybe:
import { SecureStorage } from '@aparajita/capacitor-secure-storage';
...
store: new SecureStorage()
...
// or
window.Capacitor.Plugins.SecureStoragePlugin = window.Capacitor.Plugins.AparajitaCapacitorSecureStorage;
Let me know how it goes 😉
Description
I would like to use a different capacitor plugin for secure storage. for example: capacitor-secure-storage
Proposed solution
It should be a way to provide a different secure storage
Alternatives considered
No response