java - Authy Authentication is throwing UnknownHostException -


i'm trying implement 2 phase authentication application using authy authentication. while trying verify token generated in authy mobile app m getting unknownhostexception.

package tes.resource; import com.authy.*; import com.authy.api.*; public class sampleauthenticator {     authyapiclient client=null;     public void init(){         string apikey = "api_key";         string apiurl = "http://api.authy.com";         boolean debugmode = true;          client = new authyapiclient(apikey, apiurl, debugmode);     }     public void register(string userid,string phone){         users user=client.getusers();         user.createuser(userid,phone, "57");     }     public boolean verify(){         tokens tokens = client.gettokens();         token verification = tokens.verify(27319980, "7983610");         return verification.isok();     }     public static void main(string[] args){         sampleauthenticator objsampleauthenticator=new sampleauthenticator();         objsampleauthenticator.init();          system.out.println(objsampleauthenticator.verify());     } } 

i have created application test whether authy verifying user based on random token generated in authy app.

any appreciated.

authy developer evangelist here.

first recommend change authy api key, since seem have leaked in question.

secondly, authy api url requires https. guess need change

string apiurl = "http://api.authy.com"; 

to https url:

string apiurl = "https://api.authy.com"; 

let me know if helps.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -