NbTokenService

Service that allows you to manage authentication token - get, set, clear and also listen to token changes over time.

Methods

NameDescription
clear()
returns:Observable<null>

Removes the token and published token value

get()
returns:Observable<NbAuthToken>

Returns observable of current token

set()
parameters: token: NbAuthToken
returns:Observable<null>

Sets a token into the storage. This method is used by the NbAuthService automatically.

tokenChange()
returns:Observable<NbAuthToken>

Publishes token when it changes.

NbAuthSimpleToken

Wrapper for simple (text) token

Methods

NameDescription
getCreatedAt()
returns:Date

Returns the token's creation date

getValue()
returns:string

Returns the token value

isValid()
returns:boolean

Is non empty and valid

toString()
returns:string

Validate value and convert to string, if value is not valid return empty string

NbAuthJWTToken

Wrapper for JWT token with additional methods.

Methods

NameDescription
getTokenExpDate()
returns:Date

Returns expiration date

isValid()
returns:boolean

Is data expired

parsePayload()
returns:void

Returns payload object

prepareCreatedAt()
parameters: date: Date
returns:Date

for JWT token, the iat (issued at) field of the token payload contains the creation Date

NbDummyAuthStrategy
Previous page
NbTokenLocalStorage
Next page

Need some help or found an issue?

Ask on Stack Overflow with tag `nebular` or post an issue on GitHub.