Skip to content

Instantly share code, notes, and snippets.

Barbus Sergiu danvbe

Block or report user

Report or block danvbe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@danvbe
danvbe / 0 - Explanations.md
Last active May 2, 2019
A (newer) way to integrate FosUserBundle and HWIOAuthBundle - Using Symfony 3.4 with Flex
View 0 - Explanations.md

A while ago I have written a GIST on how to integrate these using Symfony 2.4. Some time have passsed and I needed to use them in a Symfony 3.4 (with Flex) ... and I had some hard times porting everything. So, in order to provide some help for you out there... here is the way I have done it:

First of all, I had some troubles installing HWIOAuthBundle. This is the solution that worked for me. On and on, you will NOT be able to install it without errors UNTIL you set up the propper configs for the bundle.

After everything was installed and running (I will not insist here on setting up FosUserBundle, as that is pretty easy and goes smoothly), we should start and setup all the proper settings.

In this demo I have used Facebook and GitHub, but you may add any other providers.

You will get some of the config automatically setup when installing bundles, but you need to focus on:

@danvbe
danvbe / Paypal.php
Last active Sep 26, 2017
Sonata PayPal issue fix
View Paypal.php
<?php
/**
* Created by PhpStorm.
* User: danvbe
* Date: 7/25/14
* Time: 2:49 PM
*/
namespace Application\Sonata\PaymentBundle\Component;
@danvbe
danvbe / diffbot.py
Last active Aug 29, 2015
Use Diffbot to extract the pubdate of an article page from Python?
View diffbot.py
import urllib2
import json
url = "http://api.diffbot.com/v3/article?token=[your_token_here]&url=http%3A%2F%2Fblog.diffbot.com%2Fdiffbots-new-product-api-teaches-robots-to-shop-online%2F&fields=date"
req = urllib2.Request(url)
opener = urllib2.build_opener()
f = opener.open(req)
json = json.loads(f.read())
@danvbe
danvbe / 1-Explanations.md
Last active May 21, 2019
A way to integrate FosUserBundle and HWIOAuthBundle
View 1-Explanations.md

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
You can’t perform that action at this time.