@manta-eu/auth/web
Reference for @manta-eu/auth/web as it is on main.
Type Aliases
AnonymousCustomAppVisitor
AnonymousCustomAppVisitor =
CustomAppUserGrantBase&object
A visitor your app has not identified, by your session id for them: they chat, and Manta keeps no memories.
Type Declaration
anonymousId
anonymousId:
string
userId?
optionaluserId?:never
CustomAppUserAccessTokenOptions
CustomAppUserAccessTokenOptions =
IdentifiedCustomAppUser|AnonymousCustomAppVisitor
CustomAppUserGrantBase
CustomAppUserGrantBase =
object
Properties
apiUrl?
optionalapiUrl?:string
Manta’s address, https://app.hiremanta.com unless you name another deployment.
clientId
clientId:
string
The custom app’s client ID and secret, held only by the app’s server.
clientSecret
clientSecret:
string
datastores?
optionaldatastores?:string[]
Narrows the token to these datastores; leave out to reach every datastore the app reaches.
teams?
optionalteams?:string[]
Places the person in these teams of the app’s organization, by path like /Sales/EU, as a member of them. An empty list places them in no team; leaving it out places them in every team the app reaches.
IdentifiedCustomAppUser
IdentifiedCustomAppUser =
CustomAppUserGrantBase&CustomAppUserProfile&object
A person your app knows: Manta keeps their chats under your id for them, and no memories.
Type Declaration
anonymousId?
optionalanonymousId?:never
userId
userId:
string
OidcClient
OidcClient =
Omit<PublicClient,"baseUrl"|"realm"> &Realm&object
A client with a secret is an app’s own server; without one it is a public client, like the CLIs.
Type Declaration
clientSecret?
optionalclientSecret?:string
PublicClient
PublicClient =
object
Properties
baseUrl
baseUrl:
string
clientId
clientId:
string
realm
realm:
string
StartWebLoginOptions
StartWebLoginOptions =
object
Properties
idpHint?
optionalidpHint?:string
offlineAccess?
optionalofflineAccess?:boolean
redirectUri
redirectUri:
string
scope?
optionalscope?:string
WebLoginRoutes
WebLoginRoutes =
object
Methods
handle()
handle(
request):Promise<Response|undefined>
Answers the login, callback and logout paths; undefined for any other request.
Parameters
request
Request
Returns
Promise<Response | undefined>
session()
session(
request,options?):Promise<WebSession>
The signed-in person’s access token, renewed when it is about to expire, or on renew.
Parameters
request
Request
options?
Returns
Promise<WebSession>
WebLoginRoutesOptions
WebLoginRoutesOptions =
object
Properties
afterLogin?
optionalafterLogin?:string
Where people land after signing in (unless /login?returnTo= names a page) and after signing out.
afterLogout?
optionalafterLogout?:string
appUrl
appUrl:
string
Where the app runs, e.g. https://app.example.com; paths.callback under it must be a registered redirect URL.
client
client:
OidcClient&object
A confidential client: a custom app’s client ID and secret, plus baseUrl and realm off hiremanta.com.
Type Declaration
clientSecret
clientSecret:
string
cookieName?
optionalcookieName?:string
Names the session cookie (manta_session by default); on https it gets the __Host- prefix.
fetchImpl?
optionalfetchImpl?:FetchLike
idpHint?
optionalidpHint?:string
offlineAccess?
optionalofflineAccess?:boolean
paths?
optionalpaths?:object
callback?
optionalcallback?:string
login?
optionallogin?:string
logout?
optionallogout?:string
sessionSecret
sessionSecret:
string
At least 32 characters, kept on the server. Rotating it signs everyone out.
signOutOfManta?
optionalsignOutOfManta?:boolean
Off signs people out of this app only; on (the default) ends their Manta session too.
WebLoginStart
WebLoginStart =
object
Properties
state
state:
string
url
url:
string
verifier
verifier:
string
WebLogoutOptions
WebLogoutOptions =
object
Properties
idToken?
optionalidToken?:string
postLogoutRedirectUri?
optionalpostLogoutRedirectUri?:string
state?
optionalstate?:string
WebSession
WebSession =
object
Properties
accessToken
accessToken:
string|undefined
Absent when no one is signed in, or the session could not be renewed.
idToken?
optionalidToken?:string
setCookies
setCookies:
string[]
Set-Cookie values to add to the response: a renewed session, or one cleared after a refused renewal.
WebTokens
WebTokens =
object
Properties
accessToken
accessToken:
string
idToken?
optionalidToken?:string
refreshToken?
optionalrefreshToken?:string
Functions
customAppUserAccessToken()
customAppUserAccessToken(
options,fetchImpl?):Promise<string>
Gets a Manta access token for one of the app’s own users, or for an anonymous visitor. It sends the app’s client secret, so call it on the app’s server only; the token it returns may go to the browser.
Parameters
options
CustomAppUserAccessTokenOptions
fetchImpl?
FetchLike = fetch
Returns
Promise<string>
discoveryUrl()
discoveryUrl(
target?):string
The OpenID Connect discovery document most libraries configure themselves from.
Parameters
target?
Returns
string
endWebLogin()
endWebLogin(
client,refreshToken,fetchImpl?):Promise<boolean>
Revokes the refresh token, ending this app’s session only; false when Keycloak did not confirm.
Parameters
client
refreshToken
string
fetchImpl?
Returns
Promise<boolean>
finishWebLogin()
finishWebLogin(
client,login,fetchImpl?):Promise<WebTokens>
Trades the callback for tokens; pass callbackUrl and state to have them checked too.
Parameters
client
login
callbackUrl?
string
code
string
redirectUri
string
state?
string
verifier
string
fetchImpl?
Returns
Promise<WebTokens>
isRefusedWebLogin()
isRefusedWebLogin(
error):boolean
Parameters
error
unknown
Returns
boolean
issuerUrl()
issuerUrl(
target?):string
The realm’s issuer, the iss of every token it signs.
Parameters
target?
Returns
string
refreshWebLogin()
refreshWebLogin(
client,refreshToken,fetchImpl?):Promise<WebTokens|undefined>
Renews the access token; store the rotated refresh token it returns. undefined means sign in again.
Parameters
client
refreshToken
string
fetchImpl?
Returns
Promise<WebTokens | undefined>
startWebLogin()
startWebLogin(
client,options):Promise<WebLoginStart>
Starts a sign-in; keep state and verifier in the person’s session for the callback.
Parameters
client
options
Returns
Promise<WebLoginStart>
webLoginRoutes()
webLoginRoutes(
options):WebLoginRoutes
Sign-in, callback and sign-out routes for a custom app’s server, on standard Request and Response.
Parameters
options
Returns
webLogoutUrl()
webLogoutUrl(
client,options?):string
Where to send the browser to sign out of Manta too; pass the latest idToken to skip Keycloak’s prompt.
Parameters
client
options?
WebLogoutOptions = {}
Returns
string
webSessionCookieName()
webSessionCookieName(
appUrl,cookieName?):string
Parameters
appUrl
string | URL
cookieName?
string = "manta_session"
Returns
string
References
accessTokenExpiresAt
Re-exports accessTokenExpiresAt
cachedToken
Re-exports cachedToken
ClientCredentials
Re-exports ClientCredentials
defaultDeployment
Re-exports defaultDeployment
describeError
Re-exports describeError
FetchLike
Re-exports FetchLike
isTransientStatus
Re-exports isTransientStatus
mintWithClientCredentials
Re-exports mintWithClientCredentials
Realm
Re-exports Realm
RefusedRequestError
Re-exports RefusedRequestError
RenewableTokenSource
Re-exports RenewableTokenSource
TokenSource
Re-exports TokenSource
withRenewal
Re-exports withRenewal