ocilo/skype-http

getContacts fails when the login is an email address

demurgos opened this issue · 10 comments

When the credentials use an email address ({username: "example@yandex.ru", password: "bar"}), the getContacts api fails.

It sends a request to https://contacts.skype.com/contacts/v1/users/example@yandex.ru/contacts and receives a 401 - Unauthorized response with the body:

{"message":"Skype token validation failed!","stackTrace":null}

In this case, it should have sent the request to https://contacts.skype.com/contacts/v1/users/live:example/contacts.

It means that there should be some translation between the email address and corresponding Skype username to fix this issue.

Get Contacts fails when using my normal username. What do I need to do to resolve this?

Is it a vague "Unable to fetch contacts" or do you have more details?

A good starting point to investigate it would be to add logs here:

const res: io.Response = await io.get(requestOptions);

You can log the request and response and compare it to the ones used by the official skype web app.

I noticed an update of the official application yesterday so this breakage may be related.

Either your problem is caused by an API change on the Skype side or the lack of "login to username" translation described in this issue.

@James91
I am not able to reproduce the issue using skype-http but it may be related to a change in the contact URI.
When checking with the web app, they use the following email for my account:

https://contacts.skype.com/contacts/v2/users/demurgos.net?page_size=100&reason=default

@demurgos I got the contacts coming back by modifying the contact-uri and getting it to display the above URL. However, I keep getting the following error, Has the JSON changed from before?

unknown-contact-type-name: Unknown contact type name undefined

    "contacts":[  
      {  
         "person_id":"",
         "mri":"",
         "display_name":"",
         "display_name_source":"profile",
         "profile":{  
            "name":{  
               "first":"",
               "surname":""
            }
         },
         "authorized":true,
         "auth_certificate":"",
         "blocked":false,
         "favorite":true,
         "creation_time":"2017-11-13T10:29:10.9715764Z",
         "relationship_history":{  }

With regards to the contacts - what do I have to change to get it to bring back the right section.

I believe that this must of changed in the api.

"profile":{ "name":{ "first":"", "surname":"" } },

But not too sure

I will take a look at it this evening, thanks for the details.

I was able to reproduce the issue with the new URL. Still looking into the error but you are right: it's caused by a change in the data schema.

Any update on this issue?

I am planning to migrate to the new contact API during the week-end. I hope that this will solve your issue.

I updated the lib to use the new contact API.
I just want to do some tests and will send a PR today.