Skip to content

Commit

Permalink
Merge pull request #35 from ChevronETC/ccscope
Browse files Browse the repository at this point in the history
update to match EntraID docs
  • Loading branch information
samtkaplan authored Aug 19, 2024
2 parents 6f51200 + 5cb5c90 commit 9c4bc5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "AzSessions"
uuid = "f239b30d-ae6b-58be-a2d5-7e9f30e280a9"
version = "2.1.6"
version = "2.1.7"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
3 changes: 2 additions & 1 deletion src/AzSessions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,12 @@ end
function token(session::AzClientCredentialsSession; offset=Second(rand(300:600)))
session.token != "" && now(Dates.UTC) < (session.expiry - offset) && return session.token

scope = "$(rstrip(session.resource, '/'))/.default"
r = @retry 10 HTTP.request(
"POST",
"https://login.microsoft.com/$(session.tenant)/oauth2/token",
["Content-Type" => "application/x-www-form-urlencoded"],
"grant_type=client_credentials&client_id=$(session.client_id)&client_secret=$(HTTP.escapeuri(session.client_secret))&resource=$(HTTP.escapeuri(session.resource))",
"grant_type=client_credentials&client_id=$(session.client_id)&client_secret=$(HTTP.escapeuri(session.client_secret))&scope=$(HTTP.escapeuri(scope))",
retry = false)

rbody = JSON.parse(String(r.body))
Expand Down

0 comments on commit 9c4bc5f

Please sign in to comment.