Once Keycloak is initialized, you can use it to authenticate users and retrieve their access tokens. You can add KeycloakGuard to your routing module to secure your application:
Finally, you can use the keycloak.authenticated flag to check if the user is authenticated and the keycloak.getToken() method to retrieve their access token:
JavaScript:
import { KeycloakService } from 'keycloak-angular';
export class SomeComponent {
constructor(private keycloakService: KeycloakService) {}
someMethod() {
if (this.keycloakService.authenticated) {
const token = this.keycloakService.getToken();
// Use the token to make authenticated requests
}
}
}
These are the basic steps to integrate Keycloak with ngx-admin (nebular). You may need to adjust the configuration to fit your specific use case.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.