Merge pull request #5707 from consuldemocracy/oauth-docs

Update OAuth documentation
This commit is contained in:
Sebastia
2024-09-30 19:30:19 +02:00
committed by GitHub
3 changed files with 43 additions and 15 deletions

View File

@@ -78,6 +78,15 @@ staging:
#
# Currently you can overwrite SMTP, SMS, manager, microsoft API,
# HTTP basic, twitter, facebook, google, wordpress and security settings.
twitter_key: ""
twitter_secret: ""
facebook_key: ""
facebook_secret: ""
google_oauth2_key: ""
google_oauth2_secret: ""
wordpress_oauth2_key: ""
wordpress_oauth2_secret: ""
wordpress_oauth2_site: ""
<<: *maps
<<: *apis
@@ -129,6 +138,9 @@ preproduction:
facebook_secret: ""
google_oauth2_key: ""
google_oauth2_secret: ""
wordpress_oauth2_key: ""
wordpress_oauth2_secret: ""
wordpress_oauth2_site: ""
<<: *maps
<<: *apis

View File

@@ -1,22 +1,29 @@
# OAuth
You can configure authentication services with external OAuth suppliers, right now Twitter, Facebook and Google are supported.
You can configure authentication services with external OAuth providers, right now Twitter, Facebook, Google and Wordpress are supported.
## 1. Create an App on the platform
For each platform, go to their developers section and follow their guides to create an app.
## 2. Set your Consul Democracy's url
## 2. Set the authentication URL of your Consul Democracy installation
They'll ask you for your Consul Democracy's auth URL, and as you can see running `rake routes` at your Consul Democracy repo locally:
They'll ask you for the authentication URL of your Consul Democracy installation, and as you can see running `rails routes |grep omniauth` at your Consul Democracy repo locally:
```bash
user_omniauth_authorize GET|POST /users/auth/:provider(.:format) users/omniauth_callbacks#passthru {:provider=>/twitter|facebook|google_oauth2/}
user_twitter_omniauth_authorize GET|POST /users/auth/twitter(.:format) users/omniauth_callbacks#passthru
user_twitter_omniauth_callback GET|POST /users/auth/twitter/callback(.:format) users/omniauth_callbacks#twitter
user_facebook_omniauth_authorize GET|POST /users/auth/facebook(.:format) users/omniauth_callbacks#passthru
user_facebook_omniauth_callback GET|POST /users/auth/facebook/callback(.:format) users/omniauth_callbacks#facebook
user_google_oauth2_omniauth_authorize GET|POST /users/auth/google_oauth2(.:format) users omniauth_callbacks#passthru
user_google_oauth2_omniauth_callback GET|POST /users/auth/google_oauth2/callback(.:format) users/omniauth_callbacks#google_oauth2
user_wordpress_oauth2_omniauth_authorize GET|POST /users/auth/wordpress_oauth2(.:format) users/omniauth_callbacks#passthru
user_wordpress_oauth2_omniauth_callback GET|POST /users/auth/wordpress_oauth2/callback(.:format) users/omniauth_callbacks#wordpress_oauth2
```
So for example the URL for facebook application would be `yourdomain.com/users/auth/facebook/callback`
So for example the URL for Facebook application would be `yourdomain.com/users/auth/facebook/callback`.
## 3. Set key & secret values
## 3. Set the key and secret values
When you complete the application registration you'll get a *key* and *secret* values, those need to be stored at your `config/secrets.yml` file:
@@ -27,6 +34,7 @@ When you complete the application registration you'll get a *key* and *secret* v
facebook_secret: ""
google_oauth2_key: ""
google_oauth2_secret: ""
wordpress_oauth2_key: ""
wordpress_oauth2_secret: ""
wordpress_oauth2_site: ""
```
*NOTE:* Also in the case of Google, verify that the APIs *Contacts API* and *Google+ API* are enabled for the application.

View File

@@ -1,20 +1,27 @@
# OAuth
Puedes configurar la autenticación con servicios externos usando OAuth, por ahora están soportados Twitter, Facebook y Google.
Puedes configurar la autenticación con servicios externos usando OAuth, actualmente se pueden utilizar Twitter, Facebook, Google y Wordpress.
## 1. Crea una aplicación en la plataforma
Para cada plataforma, sigue las instrucciones en la sección de desarrolladores de su página web.
## 2. Establece la url de tu Consul Democracy
## 2. Establece la URL de autenticación de tu instalación de Consul Democracy
Te preguntarán por la URL de autenticación de tu instalación de Consul Democracy, y como podrás comprobar corriendo la tarea `rake routes` en tu repositorio local:
Te preguntarán por la URL de autenticación de tu instalación de Consul Democracy, y como podrás comprobar corriendo la tarea `rails routes |grep omniauth` en tu repositorio local:
```bash
user_omniauth_authorize GET|POST /users/auth/:provider(.:format) users/omniauth_callbacks#passthru {:provider=>/twitter|facebook|google_oauth2/}
user_twitter_omniauth_authorize GET|POST /users/auth/twitter(.:format) users/omniauth_callbacks#passthru
user_twitter_omniauth_callback GET|POST /users/auth/twitter/callback(.:format) users/omniauth_callbacks#twitter
user_facebook_omniauth_authorize GET|POST /users/auth/facebook(.:format) users/omniauth_callbacks#passthru
user_facebook_omniauth_callback GET|POST /users/auth/facebook/callback(.:format) users/omniauth_callbacks#facebook
user_google_oauth2_omniauth_authorize GET|POST /users/auth/google_oauth2(.:format) users omniauth_callbacks#passthru
user_google_oauth2_omniauth_callback GET|POST /users/auth/google_oauth2/callback(.:format) users/omniauth_callbacks#google_oauth2
user_wordpress_oauth2_omniauth_authorize GET|POST /users/auth/wordpress_oauth2(.:format) users/omniauth_callbacks#passthru
user_wordpress_oauth2_omniauth_callback GET|POST /users/auth/wordpress_oauth2/callback(.:format) users/omniauth_callbacks#wordpress_oauth2
```
Por ejemplo para facebook la URL sería `yourdomain.com/users/auth/facebook/callback`
Por ejemplo para Facebook la URL sería `yourdomain.com/users/auth/facebook/callback`.
## 3. Establece la clave y secreto
@@ -27,6 +34,7 @@ Cuando completes el registro de la aplicación en su plataforma te darán un *ke
facebook_secret: ""
google_oauth2_key: ""
google_oauth2_secret: ""
wordpress_oauth2_key: ""
wordpress_oauth2_secret: ""
wordpress_oauth2_site: ""
```
*NOTA:* Además en el caso de Google, verifica que las APIs de *Contacts API* y *Google+ API* están habilitadas para tu aplicación en su plataforma.