functions-samples icon indicating copy to clipboard operation
functions-samples copied to clipboard

[BUG] in sample: linkedin-auth: depends on "node-linkedin" library which has been broken for 2 years

Open jkff opened this issue 4 years ago • 4 comments

Which sample has a bug?

linkedin-auth

How to reproduce the issue

Trying to follow the sample as-is hits a bug fixed by https://github.com/firebase/functions-samples/pull/826 . If you apply that PR, then you get a crash in the function exports.token in functions/index.js. The crash can ultimately be traced to the fact that the sample uses the library node-linkedin, which relies for getting user profile data on an API that LinkedIn has stopped providing almost 2 years ago, on May 1 2019: https://github.com/ArkeologeN/node-linkedin/issues/88

The sample needs to be changed to use an up to date library. I haven't found a replacement library I'm comfortable using yet though.

jkff avatar Mar 17 '21 21:03 jkff

Did you find anything?

liorshk avatar May 02 '21 12:05 liorshk

No, I implemented my own code from scratch. Turned out easier than finding a working library.

jkff avatar May 02 '21 15:05 jkff

@jkff would you be interested in submitting a PR to update the linkedin-auth sample with your from-scratch code?

jhuleatt avatar May 03 '21 16:05 jhuleatt

@jhuleatt Sorry, I don't have time to make a quality PR out of this, and besides, I realized I couldn't use the sample as-is anyway, because my code has a frontend and a backend component, while this sample is frontend-only.

My main learning was that the protocol is just not particularly hard, and you really don't need a library - I spent more time looking for a good library and debugging problems with this sample than it took to implement the protocol myself by reading the LinkedIn OAuth docs https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?tabs=HTTPS

jkff avatar May 03 '21 17:05 jkff