Skip to content
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 include_email query param value for account/verify_credentials REST API endpoint #241

Merged
merged 1 commit into from May 25, 2016
Merged

Conversation

alibitek
Copy link
Contributor

@alibitek alibitek commented Feb 5, 2016

Only 'true' and 'false' values are acceptable for it.

I've tested STTwitter on an application that is whitelisted by Twitter to access user's email address when calling GET account/verify_credentials REST API endpoint.

When calling getAccountVerifyCredentialsWithIncludeEntites method with includeEmail set to 1 , it adds the include_email parameter with the value of "1" to the query string parameters sent to the verify_credentials endpoint. (e.g. https://api.twitter.com/1.1/account/verify_credentials.json?include_email=1), however no email key is returned in the JSON response.

After further debugging I've found that setting the include_email parameter to the value of "1" is the problem.
According to the docs on the verify_credentials endpoint, the possible values for it are "true" and "false":

include_email optional

Use of this parameter requires whitelisting.

When set to true email will be returned in the user objects as a string. If the user does not have an email address on their account, or if the email address is un-verified, null will be returned.

Example Values: true

Changing the values for the include_email parameter sent to the verify_credentials endpoint to "true" (e.g. https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true), correctly returns the email parameter in the response.

I think this is either an inconsistency in the Twitter API or a deliberate decision, because other endpoint parameters accept either true, t or 1 values. (e.g. skip_status)

skip_status optional

When set to either true, t or 1 statuses will not be included in the returned user object.

Example Values: true

or include_entities, even though the include_entities documentation only says it accepts "true" or "false"

include_entities optional

The entities node will not be included when set to false.

Example Values: false

However using include_entities with a value of "1" returns the entities in the response, even though the docs don't mention that it accepts anything other than "true" or "false" for its value.

To fix the problem with the include_email parameter I propose to change the values that STTwitter sends to the verify_credentials endpoint for it.

Only 'true' and 'false' values are acceptable for it.
@alibitek
Copy link
Contributor Author

@nst Did you had time to review this?

@nst nst merged commit a15737b into nst:master May 25, 2016
@nst
Copy link
Owner

nst commented May 25, 2016

really sorry for the review delay, and many thanks for the pull request and the detailed explanations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants