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

Require a custom user agent to use the SDK #44

Closed
teolemon opened this issue Aug 22, 2023 · 8 comments
Closed

Require a custom user agent to use the SDK #44

teolemon opened this issue Aug 22, 2023 · 8 comments
Labels
✨ enhancement New feature or request

Comments

@teolemon
Copy link
Member

What

  • Require a custom user agent to use the SDK
  • Using the SDK and the API in general will remain as of today: free and accessible for everyone.
    IN the same way, we don't want to implement an API key mechanism and all that kind of stuff.
  • However, due to misuse of the API through various SDKs, we will now force all language clients to have a valid User Agent so that we can reach out in case of problems.
  • For now, We will only require an app name for the user agent.
@teolemon teolemon added the 🐛 bug Something isn't working label Aug 22, 2023
@Dwarfex
Copy link
Member

Dwarfex commented Aug 23, 2023

@teolemon - what exactly is the misuse?
I'm afraid simply adding a user agent won't solve any essential misuse - and - would not help in contacting.

Who do you reach out to on a useragent like e.g. "PHP-SDK - Crawler"?

@Dwarfex Dwarfex added ✨ enhancement New feature or request and removed 🐛 bug Something isn't working labels Aug 23, 2023
@Dwarfex
Copy link
Member

Dwarfex commented Aug 23, 2023

Would't it be better to create personalized (organizational or independent) API keys?

@epalmans
Copy link
Member

@teolemon this package is already doing this:

'headers' => ['User-Agent' => $this->parameters['app'] ?? 'Laravel Open Food Facts - https://github.com/openfoodfacts/openfoodfacts-laravel'],

@teolemon
Copy link
Member Author

@epalmans

  • Do we concatenate a custom part to the Laravel part ?
  • Is there a warning if no custom part is added ?

@Dwarfex : for now, just personalized headers.

@epalmans
Copy link
Member

  • Do we concatenate a custom part to the Laravel part ?

No. Currently, the user-agent value is populated with the name of the app the developer is using the package within. On default laravel installation this is "Laravel". As a fallback the value is set instead "Laravel Open Food Facts - https://github.com/openfoodfacts/openfoodfacts-laravel". However in practice, that latter shouldn't ever happen since the APP_NAME environment variabele is - as far as I am aware - always available and set in Laravel app's.

  • Is there a warning if no custom part is added ?

No, but it won't happen anyhow. See previous answer.

@Dwarfex
Copy link
Member

Dwarfex commented Aug 24, 2023

@teolemon

what exactly is the misuse?

@teolemon
Copy link
Member Author

It's not Laravel SDK specific, we're getting many search queries (and other) that don't make any sense for human usage, and it would be cool to have an idea of who is using the API.

@epalmans
Copy link
Member

for the SDK's in general we could maybe introduce some kind of custom headers, like X-OFF-SDK (e.g. having a value of Laravel, Android, Ruby, whatever) along with X-OFF-SDK-VERSION to specify the SDK version no.

@epalmans epalmans closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
Development

No branches or pull requests

3 participants