You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2012/06/01 19:05:25 UTC

[Couchdb Wiki] Update of "Replication" by JensAlfke

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "Replication" page has been changed by JensAlfke:
http://wiki.apache.org/couchdb/Replication?action=diff&rev1=43&rev2=44

Comment:
Corrected & cleaned up OAuth info.

  
  === Authentication ===
  
- The remote database may require authentication, especially if it's the `target` because the replicator will need to write to it. The easiest way to authenticate is to put a username and password into the URL; the replicator will use these for HTTP Basic auth.
+ The remote database may require authentication, especially if it's the `target` because the replicator will need to write to it. The easiest way to authenticate is to put a username and password into the URL; the replicator will use these for HTTP Basic auth:
+ 
+ {{{
+ {"source":"https://myusername:mypassword@example.net:5984/db", "target":"local-db"}
+ }}}
+ 
+ Be careful with this, since the password will be visible to anyone who has read access to the server `_activity` feed or (if this is a persistent replication) the `_replicator` database.
+ 
+ ==== OAuth ====
+ 
+ CouchDB supports OAuth 1 authentication, but not yet (as of CouchDB 1.2) OAuth 2.
+ 
+ To replicate with OAuth authentication, use the form in which the `source` or `target` property is an object instead of a direct URL string. Then add the OAuth tokens to the object as shown:
+ 
+ {{{
+ {"source": "example-database",
+  "target": {
+     "url": "http://example.org/example-database",
+     "auth": {
+         "oauth": {
+             "consumer_secret": "...", "consumer_key": "...", "token_secret": "...", "token": "..." } } }
+ }}}
+ 
+ ==== Username Workaround (older CouchDBs only) ====
  
  In some older versions of CouchDB, if the remote username or password contains a special character like an `@` sign, CouchDB will not handle these properly. You can work around this by making the `source` or `target` property an object, and adding a `headers` property to add a custom `Authorization:` header.
  
@@ -172, +195 @@

  {{{
  echo -n 'bob@example.com:password' | base64
  }}}
- 
- For OAuth authentication, add an `oauth` property to the `source`/`target` object. Its properties are `consumer_secret`, `consumer_key`, `token_secret` and `token`. 
  
  == Replicator database ==