From the course: Extending Laravel with First Party Packages

Using other social providers for social login

From the course: Extending Laravel with First Party Packages

Using other social providers for social login

- All right guys, hopefully you guys have had a lot of fun creating these social sign-ons. Now I do want to show you how you can work with a few additional providers with Laravel Socialite so you can start connecting to virtually any other social media provider for this single sign-on. So in this video, we're just gonna talk about how we can access other social providers with Laravel Socialite, and which ones are provided out of the box with Laravel Socialite. No need to code, just kinda lay back and listen real quick, and this'll be a fast video. So to see all of the Laravel Socialite providers, there is a website that contains all of them in one place, and that is called socialiteproviders.github.io. And so that's what we're gonna go check out right now. All right, so now before we do that, I wanna actually take you over to laravel.com to the documentation. We're gonna go down to the official packages and type and click Socialite. Okay, so Socialite currently supports authentication with Facebook, Twitter, LinkedIn, Google, GitHub and Bitbucket. So these are the providers that you can actually... Like, we got set up at Facebook and Twitter today. We didn't need to do anything further other than putting in the credentials for them and using them as a provider. It worked out of the box with Laravel Socialite. So, you can always do Facebook, Twitter, and then there's also LinkedIn, Google, GitHub, and Bitbucket. All six of these will work out of the box, no additional work needed. Now as you can see here, adapters for other platforms are provided by the community-driven site Socialite Providers. This link will just take you to where I gave you before, that socialiteproviders.github.io. So, if you find that you wanna connect to another service that's not one of those there, this is a great way to find it. There is virtually every service that offers an OAuth type login is available here. If you come down to the left, you can see 23andme, 37Signals, all the way down, Battle.net for like Blizzard games, Bit.ly, all sorts of stuff is in here. DigitalOcean, Envato, Dropbox, tons of stuff. Google+, just tons and tons of things in here. There's Instagram, Microsoft products, Patreon, things like that. There's Stripe, Uber. Tons and tons of stuff is available on here, and so you can actually just find these. Let's say you wanna connect to the YouTube API, you can connect to YouTube, and it will walk you through the process of doing that. You'll generally require something by Composer, so Composer require, that'll bring you a small little adapter. And then it will tell you to add this into your providers array, very, very basic stuff. You add a few event listeners, and it will tell you where to put those, and then that's it. You'll add a few items into your array, the key, secret, and redirect, just like we've been doing, and you'll create your app on YouTube, you'll do all of that. It will be basically the same. Everything else will actually basically be the same here, and you'll be done. So, that is everything that you would need, it's... This one basically just works out of the box. There's a little more documentation, but for the most part, all you really have to do is install Composer, and then you'll add the provider and add the listeners, and then everything else is the same as what we previously. You're just gonna add the tokens into your ENV file, make sure to add the links to those in config slash services, and you're done. So that's all it takes to add more services. So if there's another service other than Facebook and Twitter that you wanna connect to, remember that these ones are provided out of the box. So if you wanna connect to LinkedIn and Google, GitHub and Bitbucket, you don't need to do anything to do those, okay? But for other ones, you could just go ahead and do that here. So, let's say you wanna use GitLab instead of Bitbucket. You come over to GitLab, you can just install this Composer file, go into your providers, add this one line And then here's some listeners, you add these listeners into your listener file, and then you're basically done. After that point, you'll just go onto GitLab, create your app. Then you'll put all the login information for that here, put in your redirect URL, and just like we did before, put this into the config slash services, and everything else will basically work the same as it did in the videos here. So you guys have access to all of these here. There's tons of them, tons and tons and tons of them. Over a hundred different providers that you guys can connect to out of the box. So I challenge you to take a look at those and see if you can connect to some other ones that might be interesting for you. So, that's basically all there is for this section. We covered everything you need to know to get up and running with Socialite and start connecting any number of other social media providers. So throughout this section, starting off by configuring and installing Socialite, we'll get our new project up and running and get Socialite set up on there and configure it. Next, we went ahead and talked about how it works, how social sign-on works, how OAuf2 works, and stuff like that. Next, we went ahead and got create a login, so that you can login with Facebook into our new application. We'll then set up Twitter as well so that you can sign in with Twitter, set up other social logins as well, and things like GitHub and Google are set up out of the box, how you can set up other drivers as well. If there's another network, may not have a driver immediately available for Socialite. So, that's the end of this section, and thanks so much for staying tuned, and in the next section, we're gonna be looking at another official package, which is called Laravel Scout. Laravel Scout helps us set up really cool, easy site search so that you can create dynamic, live site searches, manage your resources very easily, and Laravel handles the indexing. It's a really cool program. We'll talk more about it in the next video, so I'll see you guys in section two.

Contents