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

Reject requests that don't contain a valid User Agent string #10

Closed
monfresh opened this issue May 30, 2013 · 4 comments
Closed

Reject requests that don't contain a valid User Agent string #10

monfresh opened this issue May 30, 2013 · 4 comments

Comments

@monfresh
Copy link
Member

Look into libraries that validate user agent strings.

monfresh added a commit that referenced this issue Jun 22, 2013
Require valid user agent in request. Fixes #10
@ycombinator
Copy link
Member

I'm curious: what is the use case for the API requiring a valid user agent string or a user agent string at all? Not saying this is unnecessary or wrong; just curious what use case it satisfies. Thanks.

@monfresh
Copy link
Member Author

It makes it easy to identify the application in case of errors. I borrowed this feature from GitHub's API:

All API requests MUST include a valid User-Agent header. 
Requests with no User-Agent header will be rejected. 
We request that you use your GitHub username, 
or the name of your application, for the User-Agent header value. 
This allows us to contact you if there are problems.

@ycombinator
Copy link
Member

Got it, thanks! Interesting solution for the use case. Another solution for this same use case that I've seen in the past is to identify the application via the api_key or app_id or similar parameter.

@monfresh
Copy link
Member Author

We support both requests without an X-API-Token header and those with one. If a valid token is not present, the requests are limited to 60 per hour. Otherwise, 5000 per hour. If the token is not there, we can use the user-agent for identification.

md5 added a commit to appropriate/ohana-api that referenced this issue Apr 17, 2017
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

No branches or pull requests

2 participants