2
I have an API written in PHP+Slim, which is being used by an administrative panel, and the authentication is via token, which is returned when the panel user logs in.
However, I am making a site with Angular and would like to reuse the API, but I could not understand how to make the authentication system for the site, since there is no way to return a token to it, as it has no login.
I thought of something based on the website address, but I still haven’t found how to do it.
What is the best strategy to perform this authentication?
Thanks in advance,
Thank you very much
You may not authenticate on the routes of methods that will popular the site... That is, create separate controllers for the dashboard and for the website... in my opinion...
– rpereira15
I understand @rpereira15 , but in this case I end up leaving the GET data of the API open right? That is, since I do not need authentication to popular the data on the site, I can take the authentication of the Get routes and leave only in the POST and PUT, for example... Thank you
– Tiago Silva Pereira
It actually depends a lot on what information EVERYONE can access. In a get method for users or clients you should still have authentication...
– rpereira15
So there’s the problem, the information that I will share on the site should not be opened so that someone else can use in your application or site for example, because the API is an application, and would not like to leave this data open.
– Tiago Silva Pereira
Then stipulates a fixed token and encrypted pro site, solves the problem tb...
– rpereira15
Thank you very much man, I’ll do it. I thank you for your help
– Tiago Silva Pereira