Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Custom Storage to use Memory throw exception #2064

Open
mohsenvafa opened this issue Jan 14, 2025 · 0 comments
Open

[Bug]: Custom Storage to use Memory throw exception #2064

mohsenvafa opened this issue Jan 14, 2025 · 0 comments

Comments

@mohsenvafa
Copy link

mohsenvafa commented Jan 14, 2025

Version

19.0.0

when you create a custom storage to use memory, authentication state is not persist and throw error:
Error in loading user info: Error: could not find matching config for state b6c6e5619e6a955d6cbc....

Steps to reproduce the behavior

create a custom storage as below and provide the storage class in a module using the providers array
{ provide: AbstractSecurityStorage, useClass: MemoryStorageService }

import { Injectable } from '@angular/core';
import { AbstractSecurityStorage } from 'angular-auth-oidc-client';

@Injectable()
export class MemoryStorageService implements AbstractSecurityStorage {
  private data = new Map<string, string>();
  read(key: string) {
    return this.data.get(key) || null;
  }

  write(key: string, value: any): void {
    this.data.set(key, value);
  }

  remove(key: string): void {
    this.data.delete(key);
  }

  clear(): void {
    this.data.clear();
  }
}
@mohsenvafa mohsenvafa changed the title [Bug]: Custom Storage on Memory [Bug]: Custom Storage to use Memory throw exception Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant