Authentication - MurhafSousli/ngx-wordpress GitHub Wiki
Requirements:
import { WpAuth, WpAuthRef } from '@ngx-wordpress/core';
@Component({
selector: 'app-auth-page'
})
export class AuthPageComponent {
@WpAuth()
auth: WpAuthRef;
signIn(username: string, password: string) {
this.auth.signIn(username, password).subscribe();
}
signOut() {
this.auth.signOut().subscribe();
}
}
WpAuthRef API
Name |
Description |
state |
Stream that emits auth state |
loggedIn |
Stream that emits the logged in state |
user |
Stream that emits the logged in user data |
loading |
Stream that emits auth loading state |
error |
Stream that emits auth errors |
signIn(username, password) |
Sign in |
signOut() |
Sign out |
validateToken() |
Check if token still works on the server |