AzureAuth icon indicating copy to clipboard operation
AzureAuth copied to clipboard

Cannot pass scope to request to azure to get tokens

Open glebArkhipov opened this issue 3 years ago • 1 comments

Hello,

I have noticed that scope, that is passed through resources, is ignored So when following command is executed,

TOKEN_azure <- get_azure_token(
                          resource = c("openid", "offline_access"),
                          tenant = tenant,
                          app = client_id,
                          password = client_secret,
                          auth_type="authorization_code",
                          authorize_args=list(redirect_uri=redirect),
                          version=2,
                          use_cache=TRUE,
                          auth_code=code
)

The request to azure, that is sent by library, does not contain field with scope Therefore it is not possible to get refresh token, when resource contains "offline_access"

glebArkhipov avatar Aug 22 '22 07:08 glebArkhipov

Probably, it could be fixed by changing body here https://github.com/Azure/AzureAuth/blob/master/R/classes.R#L50 to

body <- c(
  self$client,
  code=code,
  redirect_uri=redirect,
  scope=paste(self$scope, collapse = " "),
  self$token_args
)

glebArkhipov avatar Aug 22 '22 08:08 glebArkhipov