BaseInternetAccountModel
Auto-generated @jbrowse/mobx-state-tree API for the current JBrowse release — see pluggable elements for concepts. Built into JBrowse core. View source.
Properties
| Member | Description |
|---|---|
idid: ElementId | |
typetype: types.string | |
configurationconfiguration: ConfigurationReference(BaseInternetAccountConfig) |
Getters
| Member | Description |
|---|---|
namestring | |
descriptionstring | |
internetAccountIdstring | |
authHeaderstring | |
tokenTypestring | |
domainsstring[] | |
toggleContentsReactNode | Can use this to customize what is displayed in fileSelector's toggle box |
selectorLabelstring | undefined | Can use this to add a label to the UrlChooser |
showInFileSelectorboolean | Whether the fileSelector offers this account as a source to pick. Turn it off for an account that only ever matches by domain and has nothing of its own to enter — HTTP Basic, whose ephemeral per-origin accounts would otherwise pile up as toggles nobody asked for. |
tokenKeystring | The key used to store this internetAccount's token in sessionStorage |
Methods
| Member | Description |
|---|---|
handlesLocation(location: UriLocation) => boolean | Determine whether this internetAccount provides credentials for a URL |
Actions
| Member | Description |
|---|---|
| getTokenFromUser | Must be implemented by a model extending or composing this one. Pass the user's token to resolve. |
storeToken(token: string) => void | |
retrieveToken() => string | undefined | |
validateToken(token: string, _loc: UriLocation) => Promise<string> | This can be used by an internetAccount to validate a token works before it is used. This is run when preAuthorizationInformation is requested, so it can be used to check that a token is valid before sending it to a worker thread. It expects the token to be returned so that this action can also be used to generate a new token (e.g. by using a refresh token) if the original one was invalid. Should throw an error if a token is invalid. |
removeToken() => void | Clears the stored token. Also drops the in-memory cached promise so a subsequent getToken re-prompts / re-derives rather than handing back the token that was just invalidated. |
getToken(location?: UriLocation | undefined) => Promise<string> | Try to get the token from the location pre-auth, from local storage, or from a previously cached promise. If token is not available, uses getTokenFromUser. |
| addAuthHeaderToInit | |
| fetchWithToken | Run a request with the current token and, only if it comes back 401, put the token through validateToken and run it exactly once more. This is how every account's fetcher reaches a resource. |
| Gets the token and returns it along with the information needed to create a new internetAccount. | |
| getFetcher | Get a fetch method that will add any needed authentication headers to the request before sending it. If location is provided, it will be checked to see if it includes a token in it pre-auth information. |
openLocation(location: UriLocation) => RemoteFileWithRangeCache | Gets a filehandle that uses a fetch that adds auth headers |