-
Notifications
You must be signed in to change notification settings - Fork 18
Authentication
Murhaf Sousli edited this page Oct 15, 2018
·
7 revisions
- Install JSON Basic Authentication. You have to download and upload it manually to your WordPress site.
- Install JWT Authentication for WP-API. Available at the plugins store
- Install WP REST User if you want to enable user registration. Available at the plugins store
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();
}
}
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 |