Getting started
auth()
Reference for user() and requireUser().
1 min read
Service obtained with sdk.auth().
user()
js
await sdk.auth().user()No parameters.
Returns: a Promise with the JSON returned by api/auth/me (the user
profile when there is an active session).
Error conditions
- The promise rejects, for example, when the request does not complete (network or CORS) or when the response is not valid JSON.
Minimal example
html
<script type="module">
async function main() {
const sdk = new window.I6Sdk();
const user = await sdk.auth().user();
console.log(user);
}
main();
</script>requireUser()
js
await sdk.auth().requireUser()No parameters.
Returns: a Promise with the result of user(). When that result is empty
(for example null), it starts the redirect to login and returns null.
Error conditions
- The same as
user().
Minimal example
html
<script type="module">
async function main() {
const sdk = new window.I6Sdk();
const user = await sdk.auth().requireUser();
if (!user) return;
}
main();
</script>Notes
requireUser()usesuser()internally.- The login URL is described in Login flow.
Next
ingest()
File upload.
