PoP SDK - Angular
This is a library that allows you to easily integrate PoP into your Angular application.
Installation
npm install @anima-protocol/personhood-sdk-angular
# or
yarn add @anima-protocol/personhood-sdk-angular
Usage
Use the Personhood component
Import the PersonhoodSdkAngularModule
in your app.module.ts
:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import {PersonhoodSdkAngularModule} from "@anima-protocol/personhood-sdk-angular";
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
PersonhoodSdkAngularModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Then use the lib-personhood-sdk-angular
component in your app.component.html
:
<html>
<body>
<lib-personhood-sdk-angular sessionId="sessionId" onFinish="onFinish()" signCallback="signCallback()" />
</body>
</html>
Finally, add the sessionId
, onFinish
and signCallback
functions in your app.component.ts
The onFinish
callback will be called when the user has finished the PoP flow or if the session is already validated.
Its parameters follows the ones sent from the Personhood API session
object.