New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option user_params to oauth2.0_token to enable endpoint-specific access parameters. #312

Merged
merged 6 commits into from Jan 7, 2016

Conversation

Projects
None yet
3 participants
@cornf4ke

cornf4ke commented Jan 5, 2016

This branch holds the implementation for passing additional access parameters in the form of a list of named values to the oauth2.0_token function. The function refresh_oauth2.0 was modified accordingly.

The service account functionality was not touched. My only reference for the use of user_params, Microsoft Azure AD, uses quite different parameters for service-to-service authorization when compared to httr's init_oauth_service_account. See https://msdn.microsoft.com/en-us/library/azure/dn645543.aspx.

A demo for the Azure AD endpoint was added. In the committed version it uses dummy credentials and will run but not succeed.

While viewing the diffs on github, I noticed a possible typo in the demo/00Index line
"oauth2-linkedin Using linkedin api with OAuth 1.0" which probably should read "OAuth 2.0".

DanielLockau-MLPA added some commits Jan 5, 2016

This commit works with my local example code, using my Azure credenti…
…als.

Rd files have not yet been created and tests have not been run.
Add optional "user_params" parameter to auth2.0_token. This allows to…
… pass

additional parameters during token access or refresh as required by
endpoints like Azure AD.
redirect_uri = redirect_uri,
grant_type = "authorization_code",
code = code))
req_params <- c(

This comment has been minimized.

@hadley

hadley Jan 5, 2016

Member

I think it would be slightly better to use stats::modifyList() and change the order of the argument so that user_params "loses" if a name is defined in both places.

code = code
),
user_params)
req <- POST(endpoint$access, encode = "form", body=req_params)

This comment has been minimized.

@hadley

hadley Jan 5, 2016

Member

Need a space around last =

@hadley

This comment has been minimized.

Member

hadley commented Jan 5, 2016

Apart from a couple of minor things, looks good. Could you please also add a bullet point to NEWS?

@cornf4ke

This comment has been minimized.

cornf4ke commented Jan 6, 2016

Thanks for your comments. I added the news bullet and modified the code according to your notes.

hadley added a commit that referenced this pull request Jan 7, 2016

Merge pull request #312 from cornf4ke/user_params
Add option user_params to oauth2.0_token to enable endpoint-specific access parameters.

@hadley hadley merged commit d746b31 into r-lib:master Jan 7, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@cornf4ke cornf4ke deleted the cornf4ke:user_params branch Jan 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment