-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the correct function when validating google auth tokens #5018
Use the correct function when validating google auth tokens #5018
Conversation
httpsRequest.request expects the param postData and has no default value or validation to check if it is missing before using it. As a result, an error `TypeError: First argument must be a string or Buffer` is thrown when an attempt is made to authenticate with Google. A quick check on the LinkedIn, FB, and twitter authentication adapters shows they are using httpsRequest.get for their validation calls.
You are right, can you update the tests please? |
Codecov Report
@@ Coverage Diff @@
## master #5018 +/- ##
==========================================
+ Coverage 94.28% 94.29% +0.01%
==========================================
Files 121 121
Lines 8760 8760
==========================================
+ Hits 8259 8260 +1
+ Misses 501 500 -1
Continue to review full report at Codecov.
|
@flovilmart I fixed the tests, but also notice two were passing even though the incorrect function was faked. Is it worth adding a check to ensure the correct function is called? eg. |
What do you mean by that? |
The two tests spyOn(httpsRequest, 'request').and.callFake(() => {
return Promise.resolve({ sub: 'badId' });
}); |
Yeah sure, I have been a bit quick when I refactored all the Auth adapters to improve testability. If this is something you want to improve you’re very welcome to do so! |
…mmunity#5018) * Use the correct function when validating google auth tokens httpsRequest.request expects the param postData and has no default value or validation to check if it is missing before using it. As a result, an error `TypeError: First argument must be a string or Buffer` is thrown when an attempt is made to authenticate with Google. A quick check on the LinkedIn, FB, and twitter authentication adapters shows they are using httpsRequest.get for their validation calls. * Correct google auth adapter tests
httpsRequest.request expects the param postData and has no default value
or validation to check if it is missing before using it. As a result, an
error
TypeError: First argument must be a string or Buffer
isthrown when an attempt is made to authenticate with Google.
A quick check on the LinkedIn, FB, and twitter authentication adapters shows they are
using httpsRequest.get for their validation calls.