import {createAuthRequest} from "ontlogin";
<script src="ontlogin.min.js"></script>
<script>
ontlogin.createAuthRequest();
</script>
import {createAuthRequest} from "ontlogin.es.js";
import { createAuthRequest } from "ontlogin";
const authRequest = createAuthRequest();
const challenge = await fetch("server-url", { body: authRequest });
import { requestQR } from "ontlogin";
const { text, id } = await requestQR(challenge);
import { queryQRResult, cancelQueryQRResult, ErrorEnum } from "ontlogin";
try {
const challengeResponse = await queryQRResult(id);
} catch (e) {
if (e.message === ErrorEnum.UserCanceled) {
// handle cancel
} else {
// handle error
}
}
cancelQueryQRResult(); // Cancel fetching result if you need.
fetch("server-url", { body: challengeResponse });