title: Symfony HWIOAuthBundle Accesstoken
body: <p>I need to get access token on social network, example github. The logic is when my authentication user enter in profile he can put button and confirm account with social network and this situation I need access token access token oauth. I have standard registration and authentication and only I need this is get access token and set it in DB. </p>
  
  <p>I install bundle write in kernel </p>
  
  <pre><code>"hwi/oauth-bundle": "0.4.*@dev"
  new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
  </code></pre>
  
  <p>my config: </p>
  
  <pre><code>hwi_oauth:
  connect:
    account_connector: app.provider.user_provider
  
  firewall_name: secured_area
  
  resource_owners:
      github:
          type:                github
          client_id:           "%github_app_id%"
          client_secret:       "%github_app_secret%"
          scope:              "user,public_repo"
  </code></pre>
  
  <p>and my routing:</p>
  
  <pre><code>hwi_oauth_redirect:
  resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
  prefix:   /connect
  
  hwi_oauth_login:
  resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
  prefix:   /login
  
  github_login:
  path: /login/check-github
  </code></pre>
  
  <p>and routnig in bundle</p>
  
  <pre><code>hwi_oauth_security:
  resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
  prefix: /login
  
  hwi_oauth_connect:
  resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
  prefix: /login
  
  hwi_oauth_redirect:
  resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
  prefix:   /login
  </code></pre>
  
  <p>and my security:</p>
  
  <pre><code>firewalls:
          secured_area:
          anonymous: ~
          oauth:
              resource_owners:
                  github:          "/login/check-github"
              login_path:        /login
              use_forward:       false
              failure_path:      /login
  
              oauth_user_provider:
                  service: app.provider.user_provider
  </code></pre>
  
  <p>and config for service:</p>
  
  <pre><code>&lt;parameters&gt;
          &lt;parameter key="my_user_provider.class"&gt;Artel\ProfileBundle\Providers\UserProvider&lt;/parameter&gt;
  &lt;/parameters&gt;
  
          &lt;service id="app.provider.user_provider" class="%my_user_provider.class%"&gt;
  
          &lt;argument type="collection"&gt;
              &lt;argument key="github"&gt;githubId&lt;/argument&gt;
          &lt;/argument&gt;
  
          &lt;call method="setGithubProvider"&gt;
              &lt;argument type="service" id="geekhub.user.github_provider" /&gt;
          &lt;/call&gt;
  
      &lt;/service&gt;
  
  class UserProvider implements OAuthAwareUserProviderInterface
  {
  /**
   * {@inheritDoc}
   */
  public function connect(UserInterface $user, UserResponseInterface $response)
  {
     //I think this I get access token in request
  }
  
  /**
   * {@inheritdoc}
   */
  public function loadUserByOAuthUserResponse(UserResponseInterface $response)
  {
  }
  </code></pre>
  
  <p>and in template </p>
  
  <pre><code> &lt;a class="logo" href="{{ path('hwi_oauth_service_redirect', {'service' : 'github'}) }}"&gt;Gh&lt;/a&gt;
  </code></pre>
  
  <p>but I have error </p>
  
  <pre><code>Unable to generate a URL for the named route "hwi_oauth_connect_service" as such route does not exist.
  </code></pre>
  
  <p>stack</p>
  
  <pre><code>in app/cache/dev/appDevUrlGenerator.php at line 259   -
  public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
  {
      if (!isset(self::$declaredRoutes[$name])) {
          throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
      }
      list($variables, $defaults, $requirements, $tokens, $hostTokens, $requiredSchemes) = self::$declaredRoutes[$name];
  </code></pre>
  
  <p>How can I just get a token ? </p>
  
  <p>SOLVED</p>
  
  <p>when I add routkng in bundle routing I solved this problem</p>
  
  <pre><code>hwi_oauth_security:
  resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
  prefix: /login
  
  hwi_oauth_connect:
  resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
  prefix: /login
  
  hwi_oauth_redirect:
  resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
  prefix:   /login
  </code></pre>
  
  <p>But now I have another when I connect to git hub I have enter in rout in    hwi_oauth_connect_service action: connectServiceAction and have standard template, how to reload this controller and action and change template ??
  Or how after service app.provider.user_provider make redirect in my routing? </p>