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

chore: remove z param from the API #2591

Merged
merged 10 commits into from
Aug 17, 2024

Conversation

ioslife
Copy link
Contributor

@ioslife ioslife commented Aug 4, 2024

After recognizing that the username (z) param in the API calls doesn't affect anything, I started investigating why we weren't ensuring that the provided API key (y param) matches User->APIKey. I thought this to be a bug, but it appears that Laravel doesn't need the username.

It looks like the way that the auth guards are designed (by Laravel, not RA), providing an API token is all you need. https://laravel.com/docs/5.8/api-authentication

From what I am reading online, there doesn't seem to be any reason to include username and API token. From what I can tell, we aren't even ingesting the z= value anywhere in our API for auth purposes.

AuthServiceProvider.php seems like it used to with an override, but even that isn't set up right (it is also commented out).

TL;DR – the z param on API requests seems to be unnecessary. The API token should be the sole authentication method.

@ioslife ioslife marked this pull request as ready for review August 4, 2024 21:05
@ioslife
Copy link
Contributor Author

ioslife commented Aug 6, 2024

docs: RetroAchievements/api-docs#58

@@ -72,7 +72,6 @@ protected function buildExceptionContext(Throwable $e): array
unset($params['p']);
}
} elseif (str_contains($context['url'], '/API/')) {
unset($params['z']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably still exclude this from the exception log, as consumers will likely continue to pass it for quite some time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good point. Will revert.

@ioslife
Copy link
Contributor Author

ioslife commented Aug 17, 2024

There was a merge conflict here in a file I didn't touch, but seems to be resolved now

@wescopeland wescopeland merged commit a178768 into RetroAchievements:master Aug 17, 2024
5 checks passed
@ioslife ioslife deleted the api-remove-z-param branch August 17, 2024 20:03
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.

3 participants