Blocking auth requests
This approach sends an authentication request and waits for the user to respond before continuing the execution.
This approach is useful when you want to wait for a user to respond to the authentication before continuing, and you don’t have timeout limitations on your server. An example could be authenticating a user on your command line script.
Lets see how it works, the functions below show a full cycle for a blocking authentication.
begin
@app.authentication.request("1112223334").accepted?
rescue => e # An exception will be raised in case of a timeout or internal error
return false
end
resp, err != client.AuthenticationService().Request("1112223334")
if err != nil {
println("authentication rejected")
return
}
println(resp.Accepted)
try {
let res = await client.authentication().request("1112223334")
if(res.isAccepted() == true) {
client.logger.info(`${res.selfID} is now authenticated 🤘`)
} else if(res.accepted == false) {
client.logger.warn(`${res.selfID} has rejected your authentication request`)
} else {
client.logger.error(res.errorMessage)
}
} catch (error) {
client.logger.error(error.toString())
}