Open delthas opened 7 years ago
There was a code on how to login in a Microsoft account at https://github.com/samczsun/Skype4J/issues/128 , but the message was deleted (and the user account doesn't exist anymore)
Maybe @Manevolent still has his fix for Skype4J?
I think I know how to do this, the process is detailed here: https://github.com/msndevs/protocol-docs/wiki/Authentication#microsoft-accounts
I do!
https://gist.github.com/Manevolent/1c6bc379c10c1e50358e8f2e2356fef7
That's what I've been using since the mentioned ticket, I made some minor changes to the original poster's source but this has been working fine for me.
JSONObject object = LiveLoginHelper.getXTokenObject(username, password);
String skypeToken = object.getString("skypetoken");
String skypeId = object.getString("skypeid");
MSFTSkypeClient client = new MSFTSkypeClient.Builder(skypeToken, skypeId)
.withLogger(Logger.getGlobal())
.withExceptionHandler(handler)
.withAllResources().build();
client.login();
...
The changes I made just sanitize the XML email/password, and acknowledge the "skypeId" returned in my code block above, which is very important if you're using a migrated (skypename -> email) account, which I have been using. I've been having some issues with the auth sticking, though, and sometimes my bot will randomly log out and stay that way until I address it. Until I figure that out, I'll probably wait to make a pull request.
Also, maven deps:
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
Also, JSoup is used, too.
@Manevolent since we are 4 months later, were you able to resolve your auth issues? A pull request would still come in handy :hankey:
I think this should be put in higher priority, as all skype account are forced to link with Microsoft now...
May be it can help: https://skpy.t.allofti.me/protocol/login.html
@Manevolent I get this:
org.json.JSONException: JSONObject["wst:RequestedSecurityToken"] not found.
Exception in thread "main" java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 1
Can anyone please help me out on this?
Simply removing the line from the gist seems to work... weird. the line is "this.cookies.put(setCookie[0], setCookie[1]);"
@Erezbiox1 any chance you got a fork of this with the fix applied for logging in with email and password or provide a short guide on how to get this working? Thank you!
Hello, I will look into this this week. Sorry for the long delay. To be honest I wasn't sure if anyone needed this at all.
@metasonic Yes, here's the gist, and here's the required libraries: Do note, this only works with Skype4J
@Erezbiox1 Thanks a lot for that, integrated it locally with Skype4J, tested it and it works, but having issues using the packaged Skype4J in another project.
Getting the following error:
Exception in thread "main" java.lang.NoSuchMethodError: org.json.JSONArray.forEach(Ljava/util/function/Consumer;)V at com.samczsun.skype4j.internal.client.MSFTSkypeClient$LiveLoginHelper.parsePayload(MSFTSkypeClient.java:206) at com.samczsun.skype4j.internal.client.MSFTSkypeClient$LiveLoginHelper.getXTokenObject(MSFTSkypeClient.java:267) at com.samczsun.skype4j.SkypeBuilder.build(SkypeBuilder.java:134)
After adding the class to the project made the following change to SkypeBuilder `public Skype build() { if (resources.isEmpty()) { throw new IllegalArgumentException("No resources selected"); } if (password != null && !username.contains("@")) { return new FullClient(username, password, resources, customLogger, errorHandlers); } else if (chatId != null && !username.contains("@")) { return new GuestClient(username, chatId, resources, customLogger, errorHandlers); } else if (username.contains("@")) { JSONObject object = null; try { object = MSFTSkypeClient.LiveLoginHelper.getXTokenObject(username, password); } catch (Exception e) { throw new IllegalArgumentException("Bad response"); }
String skypeToken = object.getString("skypetoken");
String skypeId = object.getString("skypeid");
return new MSFTSkypeClient(skypeToken, skypeId,
resources, customLogger,
errorHandlers);
} else {
throw new IllegalArgumentException("No chat specified");
}`
@Delthas the framework you buit is the perfect plug and play not stress that you need for Skype, so, I for one love it and would like to see it grow
Hello. Good news! I have added support for Microsoft accounts to JavaSkype. There are no API changes besides the fact that logging with a Microsoft account (e.g. foo.bar@hotmail.com) should work.
Please update to version 1.0.22 (I have copied the <dependency>
block below). Open a new issue for any problem you may have, but do send me the debug logs when opening an issue (simply call setDebug to create a debug file).
<dependency>
<groupId>fr.delthas</groupId>
<artifactId>javaskype</artifactId>
<version>1.0.22</version>
</dependency>
@Delthas thanks for tackling this issue in such a speedy fashion now :). There still seems to be a problem when using a Skype account that has been linked to a Microsoft account (as is the case for me). I can provide two debug logs (one for Skype login, one for Microsoft Account login) and would be quite willing to help resolve this -- kindly contact me via e-mail.
@Delthas thanks a lot for this!
After doing the following steps skype.connect(); remains stuck Steps:
Exception in thread "Skype-Receiver-Thread" java.lang.IllegalArgumentException at fr.delthas.skype.NotifConnector.parseEntity(NotifConnector.java:792) at fr.delthas.skype.NotifConnector.updateThread(NotifConnector.java:738) at fr.delthas.skype.NotifConnector.processPacket(NotifConnector.java:254) at fr.delthas.skype.NotifConnector.lambda$new$0(NotifConnector.java:73) at java.lang.Thread.run(Thread.java:745)
Debug logs https://www.dropbox.com/s/5mql7cyxs9na9tj/debug3.txt?dl=0 https://www.dropbox.com/s/e6uzyrjos7gfefl/debug2.txt?dl=1
Some users would like to use this library with Microsoft accounts (#23), maybe add that in the future.