Skip to content

Documentation for the OAuth2 integration #1113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

imankurpatel000
Copy link

I am creating a new pull request to merge the documentation done by @iCodr8 in the original Pull Request #182 Since he doesn't seem to have the original pull request branch and this documentation is pending for a long time. This refers to issue #180.

I have also made changes as suggested by @dunglas in that original pull request. Can someone please review this and let me know if this looks correct?

@imankurpatel000
Copy link
Author

Hello guys, any update on this?

@dunglas
Copy link
Member

dunglas commented Jul 10, 2020

@chalasr would you mind to take a look if it looks good to you? I never used FOSOAuth :/

# http://symfony.com/doc/current/book/security.html
security:
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resource: "@FOSOAuthServerBundle/Resources/config/routing/authorize.xml"
```

## Create clients
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Create clients
## Create Clients


## Create clients

Add this class to `AppBundle/Command/CreateOAuthClientCommand.php` to generate oauth clients via console:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Add this class to `AppBundle/Command/CreateOAuthClientCommand.php` to generate oauth clients via console:
Add this class to `api/src/Command/CreateOAuthClientCommand.php` to generate Oauth clients via console:

Other paths and namespaces must be updated accordingly.

<?php
// AppBundle/Entity/RefreshToken.php

namespace AppBundle\Entity;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
namespace AppBundle\Entity;
namespace App\Entity;

Same everywhere

Copy link
Contributor

@chalasr chalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As hinted by review comments, code samples looks based on outdated Symfony standards (directory structure, naming conventions, configuration ...), actually that's because the upstream (FOSOAuthServerBunde) documentation is outdated.
Even worse, the bundle is not ready for Symfony 5.
So I'm wondering... is it worth the hassle?

use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpFoundation\Request;

class CreateOAuthClientCommand extends ContainerAwareCommand
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bundle already provides a similar command out of the box, isn't it?

@imankurpatel000
Copy link
Author

@chalasr You are right, the FOSOAuthServerBunde is not ready for Symfony 5. I actually ended up using trikoder/oauth2-bundle instead of FOSOAuthServerBunde for OAuth in our project. I can try to write documentation for integrating trikoder/oauth2-bundle instead of FOSOAuthServerBunde with api platform. trikoder/oauth2-bundle is already compatible with Symfony 5. Let me know if that is something that would be useful.

@vinceAmstoutz
Copy link
Contributor

A deprecated version of API Platform. Feel free to reopen it in our last version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants