delthas / JavaSkype

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

Unable to connect. Wrong credentials Exception #45

Open panipsilos opened 6 years ago

panipsilos commented 6 years ago

Hi,

Is the library working? I am not able to connect to skype. I get wrong credentials exception. However, the credentials are correct.

scoopex commented 6 years ago

Same here :-)

An error occured while connecting...
java.io.IOException: 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)
    at name.schoechlin.zabbix.skype.Bot.main(Bot.java:29)
Caused by: fr.delthas.skype.ParseException: org.json.JSONException: JSONObject["username"] not found.
    at fr.delthas.skype.WebConnector.updateUser(WebConnector.java:163)
    at fr.delthas.skype.WebConnector.updateContacts(WebConnector.java:89)
    at fr.delthas.skype.WebConnector.refreshTokens(WebConnector.java:43)
    at fr.delthas.skype.Skype.connect(Skype.java:157)
    ... 2 more
Caused by: 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)
    ... 5 more

Double checked account credentials. Tried to use mail address and skype-alias as login.

hunghd60115 commented 6 years ago

I have same issue

Login with my gmail, live:username... the same error return.

Error while connecting to Skype: Too many failed authentication attempts with given username or IP.

Please help me fix this issue. I can login normal util today...

Note: checked account credentials by login Skype Web

hunghd60115 commented 6 years ago

Dear @delthas,

More information about the problem:

Class Webconnector, method updateContacts() Line 91 selfResponse return this {"status":{"code":40000,"text":"Value of header 'Accept' has to be any from list '*/*, application/*, application/json'"}}

Do you have any idea about this?

Best Regards,

kdarrey commented 6 years ago

I still having the same problem. Had it been solved?

Wani4ka commented 6 years ago

up

fabiodepin commented 6 years ago

hello, see my last commit, it's has been solved. https://github.com/fabiodepin/JavaSkype/commit/c3d3cd2ce07dc54390484fb817f9834c57fd4e13

apovn commented 6 years ago

@fabiodepin I followed your fixing but it's not solved problem. Did you fix this problem or use another solution ?

metasonic commented 6 years ago

Did anyone manage to find a fix for this issue?

unnivm commented 6 years ago

I am also getting the same error. Is there any solution for this issue?

metasonic commented 6 years ago

Still investigating, made it work for 1 out of 3 accounts, for the rest the issue is a 911 error. An issue for that was already added. Will post some code snippets later today

unnivm commented 6 years ago

okay. thank you

metasonic commented 6 years ago

https://pastebin.com/cr68Quhy With this changes, it works for 1 account, please note that this line is incorrect if (command.equals("715")||command.equals("911")) { if 911 is received something is wrong

Also, the fact that we added userJSON.optJSONObject("profile"); as optional is wrong again but works as a hacky fix

haroflow commented 6 years ago

I've got it working with an older Skype account, and two newer ones from Microsoft.

metasonic commented 6 years ago

@haroflow any chance you can share the code for getSelfLiveUsername() ?

haroflow commented 6 years ago

@metasonic You can find it here: https://github.com/fabiodepin/JavaSkype/commit/c14d2d74a6fef14316642b097cba3cbcc2db27a4

metasonic commented 6 years ago

@haroflow issue still occurs if you use an old account, investigating the issue. Really appreciate that you fixed the ms accounts issues though, amazing work!!

metasonic commented 6 years ago

no luck so far, not really sure what changed for old skype accounts. @delthas any chance you can point us in the right directions?

haroflow commented 6 years ago

@metasonic Thank you for the feedback!

My skype account is pretty old (+8 years). Not sure what could be happening with yours... When I started on this I had different results logging in with either email or username. Have you tried both?

Any changes to the error messages? Could you post the stacktrace or the debug logs?

You may contact me on skype if you'd like, same username as here, we can debug this. :)

delthas commented 6 years ago

@metasonic sorry, I don't really have time to really investigate this issue myself now.

@haroflow good points, when I added the Microsoft login support I kind of expected that the username wouldn't be the same if the user corresponding to the email was already registered, but I didn't have any account to investigate this.

Some pointers if you'd like to investigate this further:

Also you can join #msndevs in freenode where these libs and docs developers are (although not really active), one of the devs may have a custom Skype build that may help you with investigating how Skype works, ask if you need it. You can also run Miranda and use its debug logs to see what messages are sent and received.

fabiodepin commented 6 years ago

Hello,

1... the problem for this issue (#45 and #41) has been solved on commit fabiodepin/JavaSkype@c3d3cd2.

2... the problem recently mentioned by @metasonic has been reported on other issue: issue #30 (fr.delthas.skype.ParseException: Error message received: 911 2 CON 23). And this second has been solved by @haroflow. My tests on my account with more than twenty years old, worked perfectly. Good job @haroflow.

@metasonic please send your debugFile to pastebin and comment on issue #30 to we help you

metasonic commented 6 years ago

@delthas was looking for guidance on what where to look mostly, as based on https://github.com/msndevs/protocol-docs/wiki the auth process is correct. I started looking over Miranda logs, thanks a lot for this suggestion!!

@haroflow @fabiodepin amazing job on this one!

@fabiodepin are you planning on supporting this? I want to extend the notification capabilities of this to cover new things added to Skype and would love to contribute instead of creating a new fork

apovn commented 6 years ago

Hi all I found out that this app can login and send message successfully on my local machine Windows OS. But when I upload it to my VPS (Ubuntu 16.0.4, x64), it raised errors: java.io.IOException: Error while connecting to Live: refresh token not found. and java.io.IOException: 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)

I debugged the code and see that the bug was caused in LiveConnector.java, this line: Response post = Jsoup.connect(postUrl).data("PPFT", PPFT, "login", username, "passwd", password).cookie("MSPOK", MSPOK).maxBodySize(100 * 1024 * 1024).timeout(10000).method(Method.POST).followRedirects(false).ignoreContentType(true).ignoreHttpErrors(true).execute();

has error in return value.

I debugged and saw that:

I printed out my postUrl variable:

https://login.live.com/ppsecure/post.srf?client_id=00000000480BC46C&scope=service%3A%3Askype.com%3A%3AMBI_SSL&response_type=token&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf&state=999&locale=en&contextid=272DBD96F7CDC7C0&bk=1531600986&uaid=4ef892801b2a419097bc2a29c995100b&pid=15216
PPFT: DdhOTkhlbGjMhRSqF6ZK9qa44tAfkB85hMEnVM6FR4DL!MnNhuoFOLiDmhBlC5q1HYtuopG1eQ89*4MMuH417F5t12SVH2ANw7jYbt21zYHZBTKDpDHfuuBNddh00s406lYM1CEQq4KjLE!DuUDDC6PNSW!h2SWrQvicnfCgJoHGBUbPlGOCBwXX7jHjfXCG9*YLqdJ*UUOaszchqZhuhwc$

@delthas @fabiodepin @haroflow I appreciate your guidance. I've applied your code update but errors still occur. I read all threads but I still can't fix it. I really need this to be fixed. Have you ever tested it in Ubuntu ? Have you encountered the same error at that line of code ?

Thanks

apovn commented 6 years ago

Has anyone tested this app on Linux ? I bought a VPS (digital ocean) and run this app but it's not successful. I'm using Microsoft account ( ...@outlook.com) and it occurs error "java.io.IOException: Error thrown during connection. Check your credentials?" only in Linux OS ?

metasonic commented 6 years ago

@apovn have you tried on a local VM running Linux? Just tried on a local VM running peppermint and it works. You should try to login on a browser from that machine, as login may be blocked if MS security mechanism detects something suspicious. If I remember correctly, you should get an email in that case.

apovn commented 6 years ago

@metasonic How can I try login on a browser on Ubuntu. I have VPS and connect to it via SSH and run command only. I feel this problem is really weird.

apovn commented 6 years ago

@metasonic I tested on local machine (Ubuntu OS) but it's not success. Could you send me the source code that you run successfully on peppermint. My email tritranducATgmail.com.

apovn commented 6 years ago

Hi @delthas, can you help me this problem ?

Do you know why this line of code in LiveConnector.java, refreshTokens() method: Jsoup.connect(postUrl).data("PPFT", PPFT, "login", username, "passwd", password).cookie("MSPOK", MSPOK).maxBodySize(100 * 1024 * 1024).timeout(10000).method(Method.POST).followRedirects(false).ignoreContentType(true).ignoreHttpErrors(true).execute();

always return statusCode = 200 on Linux (Ubuntu) and in this case post.header("Location") will return null. So that in Ubuntu app can not get refreshToken. I expect statusCode=302, not 200.

Do I have to config anything more in Ubuntu ?

Anyone know about this case ? I appreciate your help.

haroflow commented 6 years ago

@apovn We've been testing this on Debian (an old version) and Mint 18 (based on 16.04.1-Ubuntu), and it's working fine... I'll contact you via e-mail.

apovn commented 6 years ago

@haroflow Thank you.

Akitha commented 6 years ago

Same here :-)

An error occured while connecting...
java.io.IOException: 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)
  at name.schoechlin.zabbix.skype.Bot.main(Bot.java:29)
Caused by: fr.delthas.skype.ParseException: org.json.JSONException: JSONObject["username"] not found.
  at fr.delthas.skype.WebConnector.updateUser(WebConnector.java:163)
  at fr.delthas.skype.WebConnector.updateContacts(WebConnector.java:89)
  at fr.delthas.skype.WebConnector.refreshTokens(WebConnector.java:43)
  at fr.delthas.skype.Skype.connect(Skype.java:157)
  ... 2 more
Caused by: 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)
  ... 5 more

Double checked account credentials. Tried to use mail address and skype-alias as login.

Did you get fixed this because I got the same Error

Akitha commented 6 years ago

Anyone Got fixed or Does this still works ?