OAuth in Zend Framework 2
Asked Answered
B

1

9

I am currently developing my first ZF application based on the new release 2.0.2. (I don't have any experience in ZF1)

Now I need to use OAuth to authenticate and I wonder if there's already an implementation for ZF2. I know there's a ZF1 module.

If there isn't, what would you recommend. Use PHP's native OAuth support?

Thanks for your help! Roberto

Boland answered 17/10, 2012 at 20:7 Comment(0)
J
13

There is an official OAuth package for ZF2 already. You can find some information on the ZF2 Packages website.

If you use composer you can install the package by adding the following following the directions on setting up composer here.

For the require packages, just put:

"require": {
    "zendframework/zendoauth": "2.0.*"
},

and then run:

php composer.phar install

and it will install the oauth package.

There is also the ReverseOAuth2 library which looks good. I found that on the community supported site modules.zendframework.com.

If you want to download directly, the stable version at the time of writing can be found at: https://packages.zendframework.com/composer/zendframework-zendoauth-2.0.2-release-2.0.2-91b73f.zip

Hope that helps.

Jansenism answered 17/10, 2012 at 23:7 Comment(7)
Great! Thank you! Didn't even know packages.zendframework.com existed. Only knew the module site. In order for this to work, I had to add the Zend package repository to my composer.json, which came with the Zend Skeleton Application. You already mentioned that by referring to the composer setup. However I want to point that out especially for users of the Skeleton.Boland
How come neither the docs nor the API docs on the zend framework page say anything about this component. I didn't even know that it had been ported/upgraded from Zf1 yet.Popsicle
@markus-tharkun I think packages.zendframework.com is the new home for all the modules and all of them may not make it onto the main reference guide (only guessing on the second part of that statement).Jansenism
I just tried this component and it seems to be unfinished. Doesn't work for me.Popsicle
It also seems to be missing the OAuth provider part of OAuth.Tenstrike
Downloaded the full distribution and couldn't find the OAuth package they mention : packages.zendframework.com/releases/ZendFramework-2.2.2/…. Am i missing something ?Kan
@Kan Not sure why, but that module isn't included with the full download even though it seems it should be. You have to install it separately using these directions. Also, I just updated the download link since the old one was broken.Jansenism

© 2022 - 2024 — McMap. All rights reserved.