Oauth 2: Javascript vs. PHP?

I want to add "login with XYZ" function to one of my web applications. I don't need any advanced content - just register users with one of the existing profiles so they don't have to remember another set of login credentials.

After some research, I found HybridAuth and hello.js .

I know Javascript as well as PHP, but I've never implemented OAUTH 2 support before.

From what I can see, I could technically provide an implementation of identification and authentication in both Javascript and PHP.

What would you recommend to choose, and why?

+3


source to share


2 answers


Since my question has not been answered by any comment or answer, I will answer with the additional reading I do. Hope this helps if you came here through your research on the same question.

Using your "secret client" requires the OAUTH 2 client to have some server side code (I don't want to have my "secret" on the JS client side, do i ...). Hello.js solves this through the OAUTH Proxy .



Since I prefer to minimize my dependencies on third parties in production, I would rather use PHP in the first place.

So I will be implementing using hybridauth for now.

0


source


I have implemented some functionality like "login with Facebook", here is the general pattern shown in this picture. example of Facebook login

What you need to do is, firstly, redirect the user to the Facebook Authentication Server, and when the user receives the "code" from the Facebook Authentication Server, you can get the "Access Token" by passing the "Code" to the Facebook Authentication Server (different url -address). Secondly, once you have an "access token", you can now get the user profile through the Facebook API and then save it to a database or other thing.



So the differences between hello.js and HybridAuth is that hell.js uses the browser (Javascript) to perform actions after redirecting users with "code", but HybridAuth does it on the server side (PHP). But they have the same pattern as indicated by the painting.

0


source







All Articles