amplify-angular: authState as BehaviorSubject in amplify.service.ts
See original GitHub issueHi,
It would be helpful if we change the _authState
Subject to be a BehaviorSubject @ https://github.com/aws-amplify/amplify-js/blob/master/packages/aws-amplify-angular/src/providers/amplify.service.ts#L35
I am piping the authStateChange$
observable in my CanActivate guard and with the subject it will only work on page load since that is when the value is emitted. When I navigate to other routes and back to a route guarded by the CanActivate, the pipe will not work since the Subject didn’t emit a new value.
I am happy to make a PR for this?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8
Top Results From Across the Web
AWS Amplify Auth & Angular RxJS Simple State Management
We define our public interface of our state in AuthState and create an initial object initialAuthState . We decided to use the default ......
Read more >PreAuth trigger lifecycle for denying token - Cognito/Amplify
I'm looking at amplify docs and I've set up my code to check for ... authState.state === "customConfirmSignIn"; in header.component.ts, ...
Read more >Implement Authentication in Angular using AWS Amplify -
This article is about how to implement Authentication in an Angular using AWS amplify within a very short period of time.
Read more >Customization | Amplify UI for Angular
Headers & Footers. The Authenticator has several "slots" that you can customize to add messaging & functionality to meet your app's needs.
Read more >How to use AWS Amplify and Angular to Build Cloud Enabled ...
Import AmplifyService into your component and listen for auth state changes: import { AmplifyService } from 'aws-amplify-angular'; // ... constructor( public ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I resolved it by adding my own
behaviorSubject
in my service and linking it to the stateChange:This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels or Discussions for those types of questions.