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

Good but can I have some examples if want to provide web API service with user login and password #2

Closed
ngkung opened this issue Jan 12, 2018 · 6 comments

Comments

@ngkung
Copy link

ngkung commented Jan 12, 2018

Any resources/examples that I can make references to build up API services based upon this flex backend?
I am new to Symfony 4, especially flex.
Just simple examples are enough, e.g. remote login, token exchange/management and protected web services.

Thank you so much.

@tarlepp
Copy link
Owner

tarlepp commented Jan 12, 2018

Examples you can find from http://localhost/api/doc url

@tarlepp tarlepp closed this as completed Jan 12, 2018
@OGProgrammer
Copy link

Using a username and password is easy but I'm struggling with how to authenticate with an api key. Any thoughts?

@tarlepp
Copy link
Owner

tarlepp commented Oct 18, 2018

By sending Authorization header with value ApiKey _your_api_key_here_ - source there https://github.com/tarlepp/symfony-flex-backend/blob/master/src%2FSecurity%2FApiKeyAuthenticator.php#L46

@OGProgrammer
Copy link

Yea I found the test you wrote for that but I'm getting back Doctrine\Common\Persistence\Mapping\MappingException: The class 'App\Security\ApiKeyUser' was not found in the chain configured namespaces App\Entity\

I appreciate getting back to me so quickly. I think the problem I've got now is entity manager configs.

@tarlepp
Copy link
Owner

tarlepp commented Oct 18, 2018

Hmm, must be something in your own environment because I don't see TravisCI failing - https://travis-ci.org/tarlepp/symfony-flex-backend

@OGProgrammer
Copy link

Heads up that my issue was I've implemented your "Blameable" trait on one of my entities and it was getting updated by an API Key authenticated session which causes an issue in Doctrine unitofwork when trying to get the user id from the ApiKeyUser class. I suppose this might be brought up by someone else that uses that blameable trait and update/creates an entity via API Auth. User/Pass auth works with the blameable trait with no issues.

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

3 participants