def dwolla_customer_oauth_url(user_or_order, api_type, request, next_url=""): dwolla_prep(api_type) scope = "Send|AccountInfoFull|Funding" redirect_url = user_or_order.get_dwolla_connect_url() + "?api=" + api_type if next_url: redirect_url += "&next_url=" + next_url redirect_url = request.build_absolute_uri(redirect_url) return oauth.genauthurl(redirect_url, scope=scope)
# Step 1: Generate an OAuth permissions page URL # with your application's default set redirect. # # http://requestb.in is a service that catches # redirect responses. Go over to their URL and make # your own so that you may conveniently catch the # redirect parameters. # # You can view your responses at: # http://requestb.in/[some_id]?inspect # # If you're feeling dangerous, feel free to simply use # http://google.com and manually parse the parameters # out yourself. The choice remains yours. print oauth.genauthurl("http://requestb.in/yxlywryx") # Step 2: The redirect should provide you with a `code` # parameter. You will now exchange this code for an access # and refresh token pair. access_set = oauth.get("Z/KHDIyWO/LboIGn3wGGs1+sRWg=", "http://requestb.in/yxlywryx") print access_set # Step 2.5: If you wish, you can set the library's global # access token parameter by doing the following... constants.access_token=access_set['access_token'] # Step 3: Exchange your expiring refresh token for another # access/refresh token pair.x
def testgenauthurl(self): self.assertEqual( oauth.genauthurl(), 'https://sandbox.dwolla.com/oauth/v2/authenticate?client_id=SOME%20ID&response_type=code&scope=Balance|AccountInfo' )
def testgenauthurl(self): self.assertEqual(oauth.genauthurl(), 'https://sandbox.dwolla.com/oauth/v2/authenticate?client_id=SOME%20ID&response_type=code&scope=Balance|AccountInfo')
def dwolla_organization_oauth_url(organization, request, api_type): dwolla_prep(api_type) scope = "Send|AccountInfoFull|Transactions" redirect_url = request.build_absolute_uri(organization.get_dwolla_connect_url() + "?api=" + api_type) return oauth.genauthurl(redirect_url, scope=scope)
# with your application's default set redirect. # # http://requestb.in is a service that catches # redirect responses. Go over to their URL and make # your own so that you may conveniently catch the # redirect parameters. # You can view your responses at: # http://requestb.in/[some_id]?inspect # # If you're feeling dangerous, feel free to simply use # http://google.com and manually parse the parameters # out yourself. The choice remains yours. print(oauth.genauthurl("http://requestb.in/122rdhc1")) # Step 2: The redirect should provide you with a `code` # parameter. You will now exchange this code for an access # and refresh token pair. access_set = oauth.get("Z/KHDIyWO/LboIGn3wGGs1+sRWg=", "http://requestb.in/122rdhc1") print(access_set) # Step 2.5: If you wish, you can set the library's global # access token parameter by doing the following... constants.access_token = access_set['access_token'] # Step 3: Exchange your expiring refresh token for another # access/refresh token pair.x
def dwolla_oauth_url(dwolla_obj, api_type, request, next_url=""): dwolla_prep(api_type) redirect_url = dwolla_redirect_url(dwolla_obj, api_type, request, next_url) return oauth.genauthurl(redirect_url, scope=DWOLLA_SCOPES)