[Iplant-api-dev] rauth Python library question

Rion Dooley dooley at tacc.utexas.edu
Fri Jan 24 14:02:36 MST 2014


Great. I'll add this to the README.md of the python client. Thanks for having this conversation in public so other Python developers can refer to it!

Rion

________________________________________
From: Darren Boss [dboss at email.arizona.edu]
Sent: Friday, January 24, 2014 2:30 PM
To: Rion Dooley
Cc: Discussion of iPlant API development
Subject: Re: [Iplant-api-dev] rauth Python library question

Working using python requests module.

Code is :
import requests

payload = {'grant_type': 'client_credentials', 'username': 'imicrobe',
'password': 'xxxxxxx', 'scope': 'PRODUCTION'}
auth=('BOI3cMLqSweD21NxrwZbu3Eihmwa',' XXXXXXXXXXXXXXXX')
r = requests.post('https://agave.iplantc.org/token', data=payload, auth=auth)
print r.text

Now moving back to the sdk.

On Fri, Jan 24, 2014 at 2:56 PM, Rion Dooley <dooley at tacc.utexas.edu> wrote:
> See this page for more information about getting your client credentials.  http://agaveapi.co/authentication-token-management/
>
> In your situation, I think the following are appropriate.
>
> agave = OAuth2Service(
>     client_id= <Consumer Secret from api store>,
>     client_secret=<Consumer Key from api store>,
>     name='agave',
>     authorize_url='https://agave.iplantc.org/oauth2/authorize',
>     access_token_url='https://agave.iplantc.org/oauth2/token',
>     base_url='https://agave.iplantc.org')
>
> Keep in mind that if you're doing this without a browser, you really don't need the above library, you can just pull a token directly using your consumer secret and key from the api store along with your iplant username and password. The CLI does this to cache a credential for you. An example from the quickstart examples (https://bitbucket.org/taccaci/agave-samples/src/master/QUICKSTART.md) that does this is given below:
>
> $ auth-tokens-create -S -V
> Consumer secret []: sdfaYISIDFU213123Qasd556azxcva
> Consumer key []: pzfMa8EPgh8z4filrKcBscjMuDXAQa
> Agave tenant username []: nryan
> Agave tenant password:
> Calling curl -sku "pzfMa8EPgh8z4filrKcBscjMuDXAQa:XXXXXX" -X POST -d "grant_type=client_credentials&username=nryan&password=XXXXXX&scope=PRODUCTION" -H "Content-Type:application/x-www-form-urlencoded" https://agave.iplantc.org/token
> Token successfully refreshed and cached for 3600 seconds
> {
>     "access_token": "bg1f2f732db7842ccm847b15edt5f0",
>     "expires_in": 3600,
>     "token_type": "bearer"
> }
> ________________________________________
> From: iplant-api-dev-bounces at iplantcollaborative.org [iplant-api-dev-bounces at iplantcollaborative.org] on behalf of Darren Boss [dboss at email.arizona.edu]
> Sent: Friday, January 24, 2014 1:33 PM
> To: Rion Dooley
> Cc: Discussion of iPlant API development
> Subject: [Iplant-api-dev] rauth Python library question
>
> Documentation at http://rauth.readthedocs.org/en/latest/.
>
> I'm taking values from
> https://agave.iplantc.org/store/site/pages/subscriptions.jag and I'm
> logged into my imicrobe account. Is my client_id = imicrobe,
> client_secret = Consumer Scret. Clueless on what name is used for. Are
> the authorize_url and access_token_url correct? I know you won't have
> a definitive answer but you will probably some insight that I don't
> have.
>
> from rauth import OAuth2Service
>
> agave = OAuth2Service(
>     client_id='imicrobe',
>     client_secret='removedforsecurity',
>     name='agave',
>     authorize_url='https://agave.iplantc.org/v2/auth',
>     access_token_url='https://agave.iplantc.org/v2/auth/token',
>     base_url='https://agave.iplantc.org')
> _______________________________________________
> Iplant-api-dev Mailing List: Iplant-api-dev at iplantcollaborative.org
> List Info and Archives: http://mail.iplantcollaborative.org/mailman/listinfo/iplant-api-dev
> One-click Unsubscribe: http://mail.iplantcollaborative.org/mailman/options/iplant-api-dev/dooley%40tacc.utexas.edu?unsub=1&unsubconfirm=1



More information about the Iplant-api-dev mailing list