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

[v2] Add QueryKeyAuthenticator #98

Closed
Gummibeer opened this issue Nov 5, 2022 · 7 comments
Closed

[v2] Add QueryKeyAuthenticator #98

Gummibeer opened this issue Nov 5, 2022 · 7 comments

Comments

@Gummibeer
Copy link
Contributor

Some APIs use a query param based Key authentication. For sure that's possible with a defaultQuery() method but somehow feels wrong. So how about a QUeryAuthenticator or similar named class with a signature like new QueryAuth(string $name, string $value). 🤔

@Sammyjo20
Copy link
Collaborator

Ooh yeah that could be good! So it just adds a query parameter with the key and value?

@Gummibeer
Copy link
Contributor Author

Exactly. Wasn't sure about naming but yeah, like ?key=abc123

@Sammyjo20
Copy link
Collaborator

I can definitely add that in - but I do think defaultQuery on the connector is a good approach too, you would just need to accept the API key through the constructor of the connector.

@Gummibeer
Copy link
Contributor Author

Yeah, doing it right now that way. But The authenticator feels better. And one question regarding priority.
If I use defaultQuery() to define key=1, the query authenticator with key=2 and in the request itself also defaultQuery() with key=3 - which one would be used? My hope would be that the authenticator has priority over both defaultQuery() methods - as it explicitly calls addQuery(). 🤔

@Sammyjo20
Copy link
Collaborator

I think that defaultQuery will take priority over the authenticator unfortunately. This is something that has been looked over a lot in v2 and the authenticator is basically the last thing in v2. Apologies

Screen Shot 2022-11-06 at 18 49 34

@Gummibeer
Copy link
Contributor Author

Okay, so right now the change would be (some way) even worse. 😅
But good to know and I think that in V2 an authenticator like that would make sense.

@Gummibeer Gummibeer changed the title Add QueryKeyAuthenticator [v2] Add QueryKeyAuthenticator Nov 6, 2022
@Sammyjo20
Copy link
Collaborator

This has now been added to the v2 branch!

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