*Experiences with janrain*

I wanted to get janrain work and I have spent some hours to start this
service. Maybe the following lines could help:

(1) From the book:

You can register with Janrain.com, register a domain (the name of your app)
and set of URLs you will be using, and they will provide you with an API
key.

(2) There is a short description how to use janrain in the file db.py:

## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
## register with janrain.com, write your domain:api_key in
private/janrain.key
#from gluon.contrib.login_methods.rpx_account import use_janrain
#use_janrain(auth, filename='private/janrain.key')

Both „domain:api_key“ and „private/janrain.key“ are wrong.

(3) The correct example is in the book:

Integration with OpenID, Facebook, etc.

You can use the web2py Role Base Access Control and authenticate with other
services like OpenID, Facebook, LinkedIn, Google, Dropbox, MySpace, Flickr,
etc. The easiest way is to use Janrain Engage (formerly RPX)
(Janrain.com)....

Now edit the model of your web2py application and place the following lines
somewhere after the definition of the auth object :

from gluon.contrib.login_methods.rpx_account import RPXAccount
auth.settings.actions_disabled=['register','change_password','request_reset_password']
auth.settings.login_form = RPXAccount(request,
    api_key='...',
    domain='...',
    url = "http://localhost:8000/%s/default/user/login"; %
request.application)

The first line imports the new login method, the second line disables local
registration, and the third line asks web2py to use the RPX login method.
You must insert your own api_key provided by Janrain.com, the domain you
choose upon registration and the external url of your login page.
*
*(4) Maybe the last lines should be changed to:

auth.settings.login_form = RPXAccount(request,
    api_key='...',
    domain='...',
    url = "http://your-external-address/%s/default/user/login"; %
request.application)

The first line imports the new login method, the second line disables local
registration, and the third line asks web2py to use the RPX login method.

Login at janrain.com and go to Deployment > Application Settings. On the
right side there is the „Application Info“:
The api_key  is called „API Key (Secret)“.
The domain is the „Application Domain“ *without leading *„https://“
and *without
the trailing *„.rpxnow.com/“
For example: if you have registered a website like „secure.mywebsite.org“
Janrain has turned it to the Application Domain „
https://secure-mywebsite.rpxnow.com“. Please insert only „secure-mywebsite“
as domain.
The url is the external url of your login page.

(5) Proceed to Deplayment > Application settings > Domain Whitelist
Enter „your-external-address“ and press „Save“
Without this registration you will get an error message like „The token URL
or xdReceiver has not been whitelisted“

(6) Proceed to Deployment > Sign-in for Web
and change the „Layout“ or select the „Providers“

Done – enjoy!
Regards, Martin


*For the 5th edition of the book?*

13858  -    url = "http://localhost:8000/%s/default/user/login"; %
request.application)
13858  -    url = "http://your-external-address/%s/default/user/login"; %
request.application)
13861  -The first line imports the new login method, the second line
disables local registration, and the third line asks web2py to use the RPX
login method. You must insert your own ``api_key`` provided by Janrain.com,
the domain you choose upon registration and the external ``url`` of your
login page.
13861  +The first line imports the new login method, the second line
disables local registration, and the third line asks web2py to use the RPX
login method.
13862  +
13863  +-----
13864  +Login at janrain.com and go to Deployment > Application Settings.
On the right side there is the "Application Info": The ``api_key``  is
called "API Key (Secret)".
The ``domain`` is the "Application Domain" *without leading *``https://``
and *without the trailing *``.rpxnow.com/``
13865 +
13866 +For example: if you have registered a website like ``
secure.mywebsite.org`` Janrain has turned it to the Application Domain ``
https://secure-mywebsite.rpxnow.com``. Please insert only
``secure-mywebsite`` as ``domain``. The ``url`` is the external url of your
login page.
13867 +
13868 +Proceed to Deplayment > Application settings > Domain Whitelist. Enter
your-external-address and press "Save". Without this registration you will
get an error message like "The token URL or xdReceiver has not been
whitelisted"
13869 +
13870 +Proceed to Deployment > Sign-in for Web and change the ``Layout`` or
select the ``Providers``
13871 +-----

-- 



Reply via email to