Seeing a view
Created 6 years ago by minkyov

Hello,

I have been doing a website and I need to create a facebook login but in order for it to work there needs to be a php file with the view and everything that I will need to place on the view. So far all of my views are in modules and with .twig extensions and routing to them and from them to assets like css and script files is working but I cannot write php code inside and I badly need this view to work. The idea behind it is: A user logs in with facebook and get redirected to this page where with the Facebook PHP SDK the user sees data that is taken from facebok. Am I doing something wrong? Is there a better way to go about this problem? What can you suggest? Thank you!

piterden  —  6 years ago

По-русски, понимаете?

minkyov  —  6 years ago

sadly no

piterden  —  6 years ago

Okay. Did you use Laravel? Do you know what MVC is?

minkyov  —  6 years ago

yes to both questions

piterden  —  6 years ago

You just wanted to work with Facebook PHP SDK from Twig view? Or I'm not clear with that? Tell me your main goal. Is it just login with OAuth2?

minkyov  —  6 years ago

I want people to be able to login on the website, give them user permissions and save their id in the database so they can authenticate. After they login they have a profile page on the website which shows them a picture of themselves that's taken from their facebook, their friends and they will be able to track their achievements because the website is for a university sports club that is organizing competitive sports events. I hope that makes things a bit clearer and sorry for me being a noob with all of these things.

piterden  —  6 years ago

Ya, thank you, that was much better))

I'm afraid, those tasks would be not so simple for you, without PRO-Packages, or either without somebody's help. Or it might be even both of things. I heard, you could setup OAuth2 login with api-module (I haven't done it self). Also, after fast look at your planned structure, I could say you need competitions, disciplines, results streams necessarily. And entry of disciplines stream should be a kind of competitions entry, and depending on that kind, results would have different sets of fields.

failcookie  —  6 years ago

I would recommend you look at using Socialite for Oauth integration. Quick and easy and saves a lot of pain, especially since they have a native connector to Facebook. You will probably need to hook into other API endpoints to get all of the info you need, but hopefully this is a good starting point.

Laravel Socialite: https://github.com/laravel/socialite

ryanthompson  —  6 years ago

You can wrap your PHP in a plugin? If it needs PHP .. sounds like maybe it's more suitable for a controller?

There are a number of areas that are registered for views that you can use outside of an addon too if you don't want to put it in your theme or something. For example app::foo/bar maps to /resources/{REF}/views/foo/bar.twig

oliverusselldev  —  5 years ago

You don't need to go through all that trouble of using SDK to integrate social login on your website. You can use Laravel Socialite to easily enable social logins on your website. This method is quite easier and convenient.