-
-
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
Fix for authenticating with instagram #7173
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like the proper fix after looking at the API
https://developers.facebook.com/docs/instagram-basic-display-api/reference/user
src/Adapters/Auth/instagram.js
Outdated
@@ -8,7 +8,7 @@ function validateAuthData(authData) { | |||
const apiURL = authData.apiURL || defaultURL; | |||
const path = `${apiURL}me?fields=id&access_token=${authData.access_token}`; | |||
return httpsRequest.get(path).then(response => { | |||
if (response && response.data && response.data.id == authData.id) { | |||
if (response && response.id == authData.id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI build is failing. Can you update the tests to match your change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you using any API urls or just the default graph.instagram.com? You could easily support both response
and response.data
.
const user = response.data ? response.data : response;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use defaultURL
.
OK I will apply support for both response
, and response.data
I will try to figure out how to update the tests. In the meantime I would appreciate it if you can refer me to some instructions on how to update the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can checkout the Contributing Guide
You can see that tests are failing in the CI.
The tests you are looking for should be here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much!
I will update the test. But you mentioned earlier that I can support response
and response.data
. Are you sure it would be a good practice?. In the test you send it can only cover one of the cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just copy the existing test and create a new test one. I think its best practice as I don't want a breaking change with older urls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late response, but I really spent many hours trying to find the older urls where the response includes data child object, but I didn't find any. Are you sure this was working at one point? Anyway I pushed new changes, for covering also older urls
5a7c7e4
to
2302d50
Compare
Codecov Report
@@ Coverage Diff @@
## master #7173 +/- ##
==========================================
- Coverage 94.00% 94.00% -0.01%
==========================================
Files 172 172
Lines 12835 12868 +33
==========================================
+ Hits 12066 12097 +31
- Misses 769 771 +2
Continue to review full report at Codecov.
|
2302d50
to
8a4915b
Compare
…nted in the response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you contributing!
* Fix for authenticating with instagram * Change tests for instagram authentication * Instagram authentication for the case when data child object is presented in the response
🎉 This change has been released in version 5.0.0-beta.1 |
🎉 This change has been released in version 5.0.0 |
New Pull Request Checklist
Issue Description
Instagram authentication is not working, it always returns 'Instagram auth is invalid for this user.'
The response of function httpsRequest.get(path) does not include the data object.
The user id is directly presented in the response
Approach
Remove the 'data' part from 'response.data'
TODOs before merging