Skip to content
This repository was archived by the owner on Apr 9, 2019. It is now read-only.
This repository was archived by the owner on Apr 9, 2019. It is now read-only.

Add support for Microsoft accounts #24

Open

Description

@delthas

Some users would like to use this library with Microsoft accounts (#23), maybe add that in the future.

Activity

  1. MrPowerGamerBR commented on Jan 10, 2017

    @MrPowerGamerBR

    There was a code on how to login in a Microsoft account at samczsun/Skype4J#128 , but the message was deleted (and the user account doesn't exist anymore)

    Maybe @Manevolent still has his fix for Skype4J?

  2. delthas commented on Jan 10, 2017

    @delthas
    OwnerAuthor

    I think I know how to do this, the process is detailed here: https://github.com/msndevs/protocol-docs/wiki/Authentication#microsoft-accounts

  3. Manevolent commented on Jan 10, 2017

    @Manevolent

    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.

  4. klingan commented on May 21, 2017

    @klingan

    @Manevolent since we are 4 months later, were you able to resolve your auth issues? A pull request would still come in handy 💩

  5. simk0024 commented on May 26, 2017

    @simk0024

    I think this should be put in higher priority, as all skype account are forced to link with Microsoft now...

  6. ruha9005 commented on Jun 9, 2017

    @ruha9005
  7. ItsGravix commented on Aug 13, 2017

    @ItsGravix

    @Manevolent I get this:
    org.json.JSONException: JSONObject["wst:RequestedSecurityToken"] not found.

  8. Erezbiox1 commented on Aug 24, 2017

    @Erezbiox1

    Exception in thread "main" java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 1

  9. Erezbiox1 commented on Aug 24, 2017

    @Erezbiox1

    Can anyone please help me out on this?

  10. Erezbiox1 commented on Aug 24, 2017

    @Erezbiox1

    Simply removing the line from the gist seems to work...
    weird.
    the line is "this.cookies.put(setCookie[0], setCookie[1]);"

  11. metasonic commented on Nov 7, 2017

    @metasonic

    @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!

  12. delthas commented on Nov 7, 2017

    @delthas
    OwnerAuthor

    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.

  13. Erezbiox1 commented on Nov 8, 2017

    @Erezbiox1

    @metasonic Yes, here's the gist,
    and here's the required libraries:
    image
    Do note, this only works with Skype4J

  14. self-assigned this
    on Nov 8, 2017
  15. metasonic commented on Nov 9, 2017

    @metasonic

    @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");
        }`
    
  16. metasonic commented on Nov 9, 2017

    @metasonic

    @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

  17. added a commit that references this issue on Nov 10, 2017
  18. delthas commented on Nov 10, 2017

    @delthas
    OwnerAuthor

    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>
    
  19. indeterminatus commented on Nov 10, 2017

    @indeterminatus

    @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.

  20. metasonic commented on Nov 10, 2017

    @metasonic

    @delthas thanks a lot for this!

  21. metasonic commented on Nov 10, 2017

    @metasonic

    After doing the following steps skype.connect(); remains stuck
    Steps:

    1. create a new skype object
    2. initialize connection (skype.connect();)
    3. get the groups you are into (skype.getGroups(); )
    4. disconnect
      *Notice that after doing this a few times the script will remain stuck at the skype.connect part
      PS. sometimes it gives the following error:
      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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions