Sign-in & sign-out with NearFi
Request NearFi user wallet to sign-in your application
Signing in
//request permission to call any function of your contract application
const signInResponse = await window.nearFiWallet.requestSignIn({
contractId: "your-contract-id", // the contract Id of your application
});
if (signInResponse.error) {
console.log("failed to sign-in")
} else {
console.log("sign-in success")
}
//you can also use promise to request
window.nearFiWallet.requestSignin({
contractId: "your-contract-id", // the contract Id of your application
}).then(signInResponse => {})
// Or add `methodNames` if your contract application only needs permission for some of the methods
await window.nearFiWallet.requestSignIn({
contractId: "your-contract-id", // the contract Id of your application
methodNames: ["method1", "method2"] // (optional) changed methods the app allowed to use
});Signing out
Last updated

