From 38cfa934ef2fd27ac96804d86f6f52e562a0a10b Mon Sep 17 00:00:00 2001 From: chrisweb Date: Tue, 10 May 2016 18:31:59 +0200 Subject: [PATCH] version bump, updated documentation, example config files --- .gitignore | 3 +- README.md | 174 ++++++++++-------- .../configs/facebook_api_EXAMPLE.ini | 14 ++ .../configs/google_plus_api_EXAMPLE.ini | 16 ++ .../configs/jamendo_api_EXAMPLE.ini | 14 ++ nbproject/project.properties | 7 + nbproject/project.xml | 9 + 7 files changed, 158 insertions(+), 79 deletions(-) create mode 100644 examples/FacebookOpenGraphOAuth2/application/configs/facebook_api_EXAMPLE.ini create mode 100644 examples/GooglePlusOAuth2/application/configs/google_plus_api_EXAMPLE.ini create mode 100644 examples/JamendoApiOAuth2/application/configs/jamendo_api_EXAMPLE.ini create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml diff --git a/.gitignore b/.gitignore index 207dca4..39db891 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ /examples/GooglePlusOAuth2/nbproject/ /examples/FacebookOpenGraphOAuth2/application/configs/facebook_api.ini /examples/JamendoApiOAuth2/application/configs/jamendo_api.ini -/examples/GooglePlusOAuth2/application/configs/google_plus_api.ini \ No newline at end of file +/examples/GooglePlusOAuth2/application/configs/google_plus_api.ini +/nbproject/private/ \ No newline at end of file diff --git a/README.md b/README.md index d7b1769..09faddc 100644 --- a/README.md +++ b/README.md @@ -3,72 +3,17 @@ About: Zend Framework 1 OAuth 2 Library -version 1.1.0 +version 1.1.1 Examples: ========= Zend Framework 1 OAuth 2 examples. -Jamendo API OAuth 2 -------------------- - -1) Add the latest Zend Framework and the Chrisweb library to the library directory. - -2) Setup an Apache vhost for the example: - -apache vhost.conf - -``` - - - ServerName www.jamendoapioauth2.dev - DocumentRoot /path/to/examples/JamendoApiOAuth2/public - ErrorLog "logs/jamendoapioauth2-error.log" - CustomLog "logs/jamendoapioauth2-access.log" combined - SetEnv APPLICATION_ENV "development" - - - DirectoryIndex index.php - AllowOverride All - Order allow,deny - Allow from all - - - -``` - -3) Update your hosts file: - -127.0.0.1 www.jamendoapioauth2.dev - -4) Create a Jamendi API account, then create a configuration file and add the values: - -``` -; application/configs/jamendo_api.ini - -; http://developer.jamendo.com/v3.0/oauth2 - -; to get a jamendo api account visit: https://devportal.jamendo.com/ - -; jamendo api configuration -dialogEndpoint = https://api.jamendo.com/v3.0 -oauthEndpoint = https://api.jamendo.com/v3.0 -clientId = 0000000000 -clientSecret = 0000000000000000000000000000 -callbackUrl = http://www.jamendoapioauth2.dev/jamendocallback -oauthDialogUri = /oauth/authorize -accessTokenUri = /oauth/grant -stateSecret = afs4f4g8e4asgaas -grantType = authorization_code -requestedRights = music ; = scope -responseType = code ; = response_type -``` - Facebook Open Graph API OAuth 2 ------------------------------- -1) Add the latest Zend Framework and the Chrisweb library to the library directory. +1) Add the latest "Zend" Framework linrary and the "Chrisweb" library to the library directory 2) Setup an Apache vhost for the example: @@ -93,29 +38,37 @@ apache vhost.conf ``` -3) Update your hosts file: +3) (optional) Update your hosts file: 127.0.0.1 www.facebookopengraphoauth2.dev -4) Create a Facebook API account, then create a configuration file and add the values: +3.1) or just use the localhost IP to access the example(s) -``` -; application/configs/facebook_api.ini +http://127.0.0.1 + +4) Create a Facebook API account at https://developers.facebook.com/apps + +Don't forget to set the go to "Settings" and set the correct "App Domains" (for example www.facebookopengraphoauth2.test) and also set the "Website / Site Url" (for example www.facebookopengraphoauth2.test) -; https://developers.facebook.com/docs/howtos/login/server-side-login/ +5) Finally go into "/examples/FacebookOpenGraphOAuth2/application/configs/" and rename the file "facebook_api_EXAMPLE.ini" to "facebook_api.ini" and add your own values where needed + +5.1) Or if you prefer you can also create a new configuration file named "facebook_api.ini" in "/examples/FacebookOpenGraphOAuth2/application/configs/" and add the following values: + +``` +; documentation: https://developers.facebook.com/docs/facebook-login -; facebook api configuration +; facebook OAuth api configuration dialogEndpoint = https://www.facebook.com oauthEndpoint = https://graph.facebook.com -clientId = 000000000000000000 -clientSecret = 000000000000000000000000000000 +clientId = 000000000000000000 ; change this with own values: clientId => Facebook App ID +clientSecret = 000000000000000000000000000000 ; change this with own values: clientSecret => Facebook App Secret callbackUrl = http://www.facebookopengraphoauth2.dev/facebookcallback responseType = code ; or token, none, signed_request oauthDialogUri = /dialog/oauth accessTokenUri = /oauth/access_token -stateSecret = afs4f4g8e4asgaas -; permissions https://developers.facebook.com/docs/concepts/login/permissions-login-dialog/ -requestedRights = email,user_actions.music,user_likes +stateSecret = SOME_SECRET ; change this with own values, change the secret every time you think it could have been compromised, it is used to ensure the OAuth requests really come from your app +; permissions https://developers.facebook.com/docs/facebook-login/permissions +requestedRights = email ``` Google+ API OAuth 2 @@ -146,29 +99,94 @@ apache vhost.conf ``` -3) Update your hosts file: +3) (optional) Update your hosts file: 127.0.0.1 www.googleplusoauth2.dev -4) Create a Google+ API account, then create a configuration file and add the values: +3.1) or just use the localhost IP to access the example(s) -``` -; application/configs/google_plus_api.ini +http://127.0.0.1 + +4) Create a Google+ API account at https://console.developers.google.com -; https://developers.google.com/+/api/oauth +5) Finally go into "/examples/GooglePlusOAuth2/application/configs/" and rename the file "google_plus_api_EXAMPLE.ini" to "google_plus_api.ini" and add your own values where needed + +5.1) Or if you prefer you can also create a new configuration file named "google_plus_api.ini" in "/examples/GooglePlusOAuth2/application/configs/" and add the following values: + +``` +; documentation: https://developers.google.com/+/web/api/rest/oauth ; google+ api configuration dialogEndpoint = https://accounts.google.com/o/oauth2 oauthEndpoint = https://accounts.google.com/o/oauth2 -clientId = 0000000000000000.apps.googleusercontent.com -clientSecret = 00000000000000000000000000000 -responseType = code ; https://developers.google.com/accounts/docs/OAuth2Login#responsetypeparameter +clientId = 0000000000000000.apps.googleusercontent.com ; change this with own values +clientSecret = 00000000000000000000000000000 ; change this with own values +responseType = code ; https://developers.google.com/identity/protocols/OpenIDConnect#responsetypeparameter callbackUrl = http://127.0.0.1/googlepluscallback secretType = immediate = oauthDialogUri = /auth accessTokenUri = /token -stateSecret = afs4f4g8e4asgaas -; google+ scopes https://developers.google.com/+/api/oauth#scopes +stateSecret = SOME_SECRET ; change this with own values, change the secret every time you think it could have been compromised, it is used to ensure the OAuth requests really come from your app +; google+ scopes https://developers.google.com/+/web/api/rest/oauth#authorization-scopes requestedRights = https://www.googleapis.com/auth/plus.login,https://www.googleapis.com/auth/plus.me,https://www.googleapis.com/auth/userinfo.email +``` + +Jamendo API OAuth 2 +------------------- + +1) Add the latest Zend Framework and the Chrisweb library to the library directory. + +2) Setup an Apache vhost for the example: + +apache vhost.conf + +``` + + + ServerName www.jamendoapioauth2.dev + DocumentRoot /path/to/examples/JamendoApiOAuth2/public + ErrorLog "logs/jamendoapioauth2-error.log" + CustomLog "logs/jamendoapioauth2-access.log" combined + SetEnv APPLICATION_ENV "development" + + + DirectoryIndex index.php + AllowOverride All + Order allow,deny + Allow from all + + + +``` + +3) (optional) Update your hosts file: + +127.0.0.1 www.jamendoapioauth2.dev + +3.1) or just use the localhost IP to access the example(s) + +http://127.0.0.1 + +4) Create a Jamendi API account at https://developer.jamendo.com/v3.0 + +5) Finally go into "/examples/JamendoApiOAuth2/application/configs/" and rename the file "jamendo_api_EXAMPLE.ini" to "jamendo_api.ini" and add your own values where needed + +5.1) Or if you prefer you can also create a new configuration file named "jamendo_api.ini" in "/examples/JamendoApiOAuth2/application/configs/" and add the following values: + +``` +; documentation: https://developer.jamendo.com/v3.0/authentication#oauth2-authorize-request + +; jamendo api configuration +dialogEndpoint = https://api.jamendo.com/v3.0 +oauthEndpoint = https://api.jamendo.com/v3.0 +clientId = 0000000000 ; change this with own values +clientSecret = 0000000000000000000000000000 ; change this with own values +callbackUrl = http://www.jamendoapioauth2.dev/jamendocallback +oauthDialogUri = /oauth/authorize +accessTokenUri = /oauth/grant +stateSecret = SOME_SECRET ; change this with own values, change the secret every time you think it could have been compromised, it is used to ensure the OAuth requests really come from your app +grantType = authorization_code +requestedRights = music ; = scope +responseType = code ; = response_type ``` \ No newline at end of file diff --git a/examples/FacebookOpenGraphOAuth2/application/configs/facebook_api_EXAMPLE.ini b/examples/FacebookOpenGraphOAuth2/application/configs/facebook_api_EXAMPLE.ini new file mode 100644 index 0000000..748fcdd --- /dev/null +++ b/examples/FacebookOpenGraphOAuth2/application/configs/facebook_api_EXAMPLE.ini @@ -0,0 +1,14 @@ +; documentation: https://developers.facebook.com/docs/facebook-login + +; facebook OAuth api configuration +dialogEndpoint = https://www.facebook.com +oauthEndpoint = https://graph.facebook.com +clientId = 000000000000000000 ; change this with own values: clientId => Facebook App ID +clientSecret = 000000000000000000000000000000 ; change this with own values: clientSecret => Facebook App Secret +callbackUrl = http://www.facebookopengraphoauth2.dev/facebookcallback +responseType = code ; or token, none, signed_request +oauthDialogUri = /dialog/oauth +accessTokenUri = /oauth/access_token +stateSecret = SOME_SECRET ; change this with own values, change the secret every time you think it could have been compromised, it is used to ensure the OAuth requests really come from your app +; permissions https://developers.facebook.com/docs/facebook-login/permissions +requestedRights = email \ No newline at end of file diff --git a/examples/GooglePlusOAuth2/application/configs/google_plus_api_EXAMPLE.ini b/examples/GooglePlusOAuth2/application/configs/google_plus_api_EXAMPLE.ini new file mode 100644 index 0000000..ce053df --- /dev/null +++ b/examples/GooglePlusOAuth2/application/configs/google_plus_api_EXAMPLE.ini @@ -0,0 +1,16 @@ +; documentation: https://developers.google.com/+/web/api/rest/oauth + +; google+ api configuration +dialogEndpoint = https://accounts.google.com/o/oauth2 +oauthEndpoint = https://accounts.google.com/o/oauth2 +clientId = 0000000000000000.apps.googleusercontent.com ; change this with own values +clientSecret = 00000000000000000000000000000 ; change this with own values +responseType = code ; https://developers.google.com/identity/protocols/OpenIDConnect#responsetypeparameter +callbackUrl = http://127.0.0.1/googlepluscallback +secretType = +immediate = +oauthDialogUri = /auth +accessTokenUri = /token +stateSecret = SOME_SECRET ; change this with own values, change the secret every time you think it could have been compromised, it is used to ensure the OAuth requests really come from your app +; google+ scopes https://developers.google.com/+/web/api/rest/oauth#authorization-scopes +requestedRights = https://www.googleapis.com/auth/plus.login,https://www.googleapis.com/auth/plus.me,https://www.googleapis.com/auth/userinfo.email \ No newline at end of file diff --git a/examples/JamendoApiOAuth2/application/configs/jamendo_api_EXAMPLE.ini b/examples/JamendoApiOAuth2/application/configs/jamendo_api_EXAMPLE.ini new file mode 100644 index 0000000..bb70f46 --- /dev/null +++ b/examples/JamendoApiOAuth2/application/configs/jamendo_api_EXAMPLE.ini @@ -0,0 +1,14 @@ +; documentation: https://developer.jamendo.com/v3.0/authentication#oauth2-authorize-request + +; jamendo api configuration +dialogEndpoint = https://api.jamendo.com/v3.0 +oauthEndpoint = https://api.jamendo.com/v3.0 +clientId = 0000000000 ; change this with own values +clientSecret = 0000000000000000000000000000 ; change this with own values +callbackUrl = http://www.jamendoapioauth2.dev/jamendocallback +oauthDialogUri = /oauth/authorize +accessTokenUri = /oauth/grant +stateSecret = SOME_SECRET ; change this with own values, change the secret every time you think it could have been compromised, it is used to ensure the OAuth requests really come from your app +grantType = authorization_code +requestedRights = music ; = scope +responseType = code ; = response_type \ No newline at end of file diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..76f6f91 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,7 @@ +include.path=${php.global.include.path} +php.version=PHP_56 +source.encoding=UTF-8 +src.dir=. +tags.asp=false +tags.short=false +web.root=. diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..fa70a94 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,9 @@ + + + org.netbeans.modules.php.project + + + zend-framework-1-oauth-2-library + + +