delthas / JavaSkype

A lightweight, comprehensive Java API for Skype using MSNP24
MIT License
72 stars 28 forks source link

unable to connect a microsoft account #36

Open Darko-Hacking opened 6 years ago

Darko-Hacking commented 6 years ago

Hello, following the update I am trying to connect a microsoft account. Here is the error found in the log file

nov. 13, 2017 9:09:12 PM fr.delthas.skype.Skype connect PRÉCIS: Connecting to Skype nov. 13, 2017 9:09:12 PM fr.delthas.skype.Skype reset LE PLUS PRÉCIS: Resetting the Skype object nov. 13, 2017 9:09:12 PM fr.delthas.skype.NotifConnector generateEPID LE PLUS PRÉCIS: Generated EPID: 0ad5830b-a83e-307e-683c-6fa00e105c44 nov. 13, 2017 9:09:12 PM fr.delthas.skype.LiveConnector refreshTokens PLUS PRÉCIS: Refreshing tokens nov. 13, 2017 9:09:16 PM fr.delthas.skype.LiveConnector refreshTokens PLUS PRÉCIS: Refreshed live tokens successfully nov. 13, 2017 9:09:16 PM fr.delthas.skype.WebConnector refreshTokens PLUS PRÉCIS: Refreshing tokens nov. 13, 2017 9:09:16 PM fr.delthas.skype.WebConnector generateToken LE PLUS PRÉCIS: Getting Microsoft token nov. 13, 2017 9:09:16 PM fr.delthas.skype.WebConnector sendRequest LE PLUS PRÉCIS: Sending POST request at https://api.skype.com/rps/skypetoken nov. 13, 2017 9:09:16 PM fr.delthas.skype.WebConnector sendRequest PRÉCIS: No token sent for the request at: https://api.skype.com/rps/skypetoken nov. 13, 2017 9:09:17 PM fr.delthas.skype.WebConnector sendRequest LE PLUS PRÉCIS: Sending GET request at https://api.skype.com/users/self/profile nov. 13, 2017 9:09:17 PM fr.delthas.skype.WebConnector sendRequest LE PLUS PRÉCIS: Sending GET request at https://contacts.skype.com/contacts/v1/users/live:fabien900z/contacts?$filter=authorized eq true and blocked eq false and suggested eq false

Thank you in advance for your help ;) Fabien

delthas commented 6 years ago

Hello, please send me the exception full stack trace and the username you have entered to connect. Also, have you linked your account with a Skype account? Asking because it may change the server response.

Darko-Hacking commented 6 years ago

Hello, Here is the error found in the log file

nov. 14, 2017 5:57:35 PM fr.delthas.skype.Skype connect PRÉCIS: Connecting to Skype nov. 14, 2017 5:57:35 PM fr.delthas.skype.Skype reset LE PLUS PRÉCIS: Resetting the Skype object nov. 14, 2017 5:57:35 PM fr.delthas.skype.NotifConnector generateEPID LE PLUS PRÉCIS: Generated EPID: e0b213d3-36b0-0721-89f9-242d1fbb425c nov. 14, 2017 5:57:35 PM fr.delthas.skype.LiveConnector refreshTokens PLUS PRÉCIS: Refreshing tokens nov. 14, 2017 5:57:40 PM fr.delthas.skype.LiveConnector refreshTokens PLUS PRÉCIS: Refreshed live tokens successfully nov. 14, 2017 5:57:40 PM fr.delthas.skype.WebConnector refreshTokens PLUS PRÉCIS: Refreshing tokens nov. 14, 2017 5:57:40 PM fr.delthas.skype.WebConnector generateToken LE PLUS PRÉCIS: Getting Microsoft token nov. 14, 2017 5:57:40 PM fr.delthas.skype.WebConnector sendRequest LE PLUS PRÉCIS: Sending POST request at https://api.skype.com/rps/skypetoken nov. 14, 2017 5:57:40 PM fr.delthas.skype.WebConnector sendRequest PRÉCIS: No token sent for the request at: https://api.skype.com/rps/skypetoken nov. 14, 2017 5:57:40 PM fr.delthas.skype.WebConnector sendRequest LE PLUS PRÉCIS: Sending GET request at https://api.skype.com/users/self/profile nov. 14, 2017 5:57:41 PM fr.delthas.skype.WebConnector sendRequest LE PLUS PRÉCIS: Sending GET request at https://contacts.skype.com/contacts/v1/users/live:support/contacts?$filter=authorized eq true and blocked eq false and suggested eq false

Here are the exceptions generated

"C:\Program Files\Java\jdk-9.0.1\bin\java" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\lib\idea_rt.jar=50474:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.5\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\Kost Diffusion\IdeaProjects\SkypeBot\target\classes;C:\Users\Kost Diffusion.m2\repository\fr\delthas\javaskype\1.0.22\javaskype-1.0.22.jar;C:\Users\Kost Diffusion.m2\repository\org\json\json\20160212\json-20160212.jar;C:\Users\Kost Diffusion.m2\repository\org\jsoup\jsoup\1.9.2\jsoup-1.9.2.jar" fk.diffusion.MainBot Connexion en cours... fr.delthas.skype.ParseException: org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1] at fr.delthas.skype.WebConnector.updateContacts(WebConnector.java:103) at fr.delthas.skype.WebConnector.refreshTokens(WebConnector.java:43) at fr.delthas.skype.Skype.connect(Skype.java:156) at fr.delthas.skype.Skype.connect(Skype.java:124) at fk.diffusion.MainBot.main(MainBot.java:20) Caused by: org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1] at org.json.JSONTokener.syntaxError(JSONTokener.java:433) at org.json.JSONObject.(JSONObject.java:195) at org.json.JSONObject.(JSONObject.java:319) at fr.delthas.skype.WebConnector.updateContacts(WebConnector.java:95) ... 4 more

Process finished with exit code 0

my username : support@autopostergroup.com

is not linked account skype is microsoft account

delthas commented 6 years ago

Thanks. I will look into this this week.

Darko-Hacking commented 6 years ago

Hello, did you find the solution? thank you in advance for your response

zzvara commented 6 years ago

Got the same problem.

estuardolh commented 6 years ago

@delthas, the problem seems to be the response from Contacts request. Instead using: https://contacts.skype.com/contacts/v1/users/live:support/contacts?$filter=authorized eq true and blocked eq false and suggested eq false You may try it: https://contacts.skype.com/contacts/v1/users/live:support/contacts

Regards.

zzvara commented 6 years ago

Found the problem. It happens when the Microsoft login (user.contains("@")) does not align with the live ID, which must be live:anything_before_@_sign_here.

Darko-Hacking commented 6 years ago

@zzvara could you solve the problem? If so, can you explain to me how to solve it? thank you in advance

delthas commented 6 years ago

@zzvara : Indeed, I assumed that this would always be the case. Do you have any way to create an account in such a way that this is not the case? I was considering creating a Microsoft account with examplejavaskype0123@hotmail.com and one with examplejavaskype0123@live.com and hope that the Live IDs would be different.

Anyway I should actually parse the live ID somehow instead of assuming it is the username part of the Microsoft login, probably. It would be easier if I can debug on an account with this issue.

@Darko-Hacking : En attendant que ça soit corrigé, si c'est urgent, tu peux toujours créer un nouveau compte Skype, et ne pas le relier à un compte Microsoft, et ça devrait marcher, si tu n'as pas besoin de lancer ton bot/client depuis un compte particulier.

zzvara commented 6 years ago

@delthas If you create a Skype account by only using your phone number, the ID will be live:82nvhft7237hshkhj. Even if you attach an e-mail to the account, the ID will remain the same. If you use name@outlook.com, the ID will be live:name, so your code path will not throw an exception.

The exception is thrown, due to an empty response received from Skype API as you make a call against the ID that does not exist.

delthas commented 6 years ago

@zzvara Oh yes indeed you can create a Skype account using only a phone number! Very nice. I'll try to create one and use it for debugging, thanks.

dragosPerianu commented 6 years ago

@delthas Do you have some news related to this topic? In my case I have the following errors: Error thrown during connection. Check your credentials? at fr.delthas.skype.Skype.connect(Skype.java:164) at fr.delthas.skype.Skype.connect(Skype.java:124) ... fr.delthas.skype.ParseException: org.json.JSONException: JSONObject["username"] not found. at fr.delthas.skype.WebConnector.updateUser(WebConnector.java:163) ... org.json.JSONException: JSONObject["username"] not found. at org.json.JSONObject.get(JSONObject.java:471) at org.json.JSONObject.getString(JSONObject.java:717) at fr.delthas.skype.WebConnector.updateUser(WebConnector.java:121) I'm using an account without @domain termination and credentials are correct. Thanks