Ontology Developer Center
DISCOVER
APPLICATIONS
COMMUNITY
SUPPORT
Search…
v2.5
Introduction
Discover Ontology
Getting Started
Glossary
Decentralized Identity and Data
ONT ID
Decentralized Identifiers
Verifiable Credentials
ONT Login
Scenarios
Protocol Specification
Front-end JavaScript SDK
Integration and Usage
API Reference
Front-end UI SDK
Back-end Go SDK
Back-end Java SDK
ONT TAG
Mercury
OScore
DDXF
ONTOLOGY ELEMENTS
Smart Contracts
Token Protocols
Consensus Mechanism
Ontology Oracle
GUIDES & TUTORIALS
Development Guides
Integration Guides
EVM & Token Decimals Upgrade
ONTOLOGY NODE
Abstract
Node Deployment
Interacting with a Public Node
DEVELOPER TOOLS
dApp Development Framework
IDE
APIs
Digital Wallet
SDKs
Signing Server
COMMUNITY
Ecosystem Programs
Community Libraries
Community Events
Community Channels
Core Contributors
SUPPORT
FAQ
Contact Us
Powered By
GitBook
Integration and Usage
Example apps
​
vue
​
​
pure HTML
​
Install and import package
via NPM
package
​
npm i ontlogin
import
{
createAuthRequest
}
from
"ontlogin"
;
via
js bundle
​
<
script src
=
"ontlogin.min.js"
></
script
>
<
script
>
ontlogin
.
createAuthRequest
();
</
script
>
via
es module js bundle
​
import
{
createAuthRequest
}
from
"ontlogin.es.js"
;
Generate
authRequest
and challenge
import
{
createAuthRequest
}
from
"ontlogin"
;
​
const
authRequest
=
createAuthRequest
();
const
challenge
=
await
fetch
(
"server-url"
,
{
body
:
authRequest
});
Get QR code from ontlogin QR server.
import
{
requestQR
}
from
"ontlogin"
;
​
const
{
text
,
id
}
=
await
requestQR
(
challenge
);
Show QR code UI and query scan result from ontlogin QR server
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.
Submit challenge response to your server
fetch
(
"server-url"
,
{
body
:
challengeResponse
});
Previous
Front-end JavaScript SDK
Next
API Reference
Last modified
10mo ago
Copy link
Outline
Example apps
Install and import package
Generate authRequest and challenge
Get QR code from ontlogin QR server.
Show QR code UI and query scan result from ontlogin QR server
Submit challenge response to your server