manonthemoon
manonthemoon

Reputation: 2691

Symfony 2 - FOSUserBundle, there is no access token?

I'm currently learning symfony 2 framework and I use FOSUserBundle for the management of my users. What I want to do is working with access token when user is connected. Is safer for the security. So when a user connects to the website, I should send him back an access_token, right ? Like =

access_token : sqbkktg3s00vzz7gg3s198rzb9g3s2me2u2ng3s3 ...

I thought that the framework symfony 2 does already that, or FOSUserBundle, but I couldn't find anything about that.

In the security context service of symfony 2, there is a method called getToken(). But it returns a TokenInterface object, I read what are methods of this object, I tried to use some of them, but it did nothing.

What is the best way for working with access tokens please? I'm sure there is a easy way, but I didn't find it.

Thanks

Upvotes: 1

Views: 2156

Answers (1)

marian2js
marian2js

Reputation: 819

You need to use FOSOAuthServerBundle.

FOSOAuthServerBundle was created for the same group that FOSUserBundle, and in its Documentation explain how to combine both bundles.

Check documentation and examples for FOSOAuthServerBundle:

https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/blob/master/Resources/doc/index.md

I hope I have helped!

Upvotes: 3

Related Questions