Interface: TokenStorageProvider
This interface can be implemented by the hosting app, and set in the options it should be a wrapper around access to a secure storage solution if
Ionic Identity Vault is not being used.Table of contents
Properties
- clear
- getAccessToken
- getAuthResponse
- getIdToken
- getRefreshToken
- onLock
- setAccessToken
- setAuthResponse
- setIdToken
- setRefreshToken
Properties
clear
• Optional
clear: () => Promise<void>
Clear storage.
example
storage.clear()
Type declaration:
▸ (): Promise<void>
Returns: Promise<void>
getAccessToken
• Optional
getAccessToken: (tokenName?
: string) => Promise<undefined | string>
Get the saved access token.
example
storage.getAccessToken()
param
Optional token name, only used when multiple tokens are required (Azure specific feature).
Type declaration:
▸ (tokenName?
: string): Promise<undefined | string>
Parameters:
Name | Type |
---|---|
tokenName? | string |
Returns: Promise<undefined | string>
getAuthResponse
• Optional
getAuthResponse: () => Promise<any>
Get the full auth result.
example
storage.getAuthResponse()
Type declaration:
▸ (): Promise<any>
Returns: Promise<any>
getIdToken
• Optional
getIdToken: () => Promise<undefined | string>
Get the id token.
example
storage.getIdToken()
Type declaration:
▸ (): Promise<undefined | string>
Returns: Promise<undefined | string>
getRefreshToken
• Optional
getRefreshToken: () => Promise<undefined | string>
Get the saved refresh token.
example
storage.getRefreshToken()
Type declaration:
▸ (): Promise<undefined | string>
Returns: Promise<undefined | string>
onLock
• Optional
onLock: (callback
: () => void) => void
Specify a callback to be called when the vault locks.
example
storage.onLock(() => {
// do stuff
});
Type declaration:
▸ (callback
: () => void): void
Parameters:
Name | Type |
---|---|
callback | () => void |
Returns: void
setAccessToken
• Optional
setAccessToken: (accessToken
: string, tokenName?
: string) => Promise<void>
Save the access token.
example
storage.saveAccessToken("123abcString", "mytoken")
param
Optional token name, only used when multiple tokens are required (Azure specific feature).
Type declaration:
▸ (accessToken
: string, tokenName?
: string): Promise<void>
Parameters:
Name | Type |
---|---|
accessToken | string |
tokenName? | string |
Returns: Promise<void>
setAuthResponse
• Optional
setAuthResponse: (response
: any) => Promise<void>
Save the full auth response.
example
storage.setAuthResponse("OK")
Type declaration:
▸ (response
: any): Promise<void>
Parameters:
Name | Type |
---|---|
response | any |
Returns: Promise<void>
setIdToken
• Optional
setIdToken: (idToken
: string) => Promise<void>
Save the id token.
example
storage.setIdToken("123abcString")
Type declaration:
▸ (idToken
: string): Promise<void>
Parameters:
Name | Type |
---|---|
idToken | string |
Returns: Promise<void>
setRefreshToken
• Optional
setRefreshToken: (refreshToken
: string) => Promise<void>
Save the refresh token.
example
storage.setRefreshToken("123abcString")
Type declaration:
▸ (refreshToken
: string): Promise<void>
Parameters:
Name | Type |
---|---|
refreshToken | string |
Returns: Promise<void>