Skip to content

Commit

Permalink
fix for getting android enrollment url (#26667)
Browse files Browse the repository at this point in the history
quick fix for getting android enrollment url
  • Loading branch information
ghernandez345 authored Feb 27, 2025
1 parent f2ad368 commit a4a2182
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frontend/templates/enroll-ota.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ <h1 class="error-header">

<script>
const ANDROID_GET_TOKEN_URL =
"{{.URLPrefix}}/api/v1/fleet/android/enterprise/enrollment_token";
"{{.URLPrefix}}/api/v1/fleet/android_enterprise/enrollment_token";
// using string comparison to satisfy the linter.
const ANDROID_MDM_ENABLED = "{{.AndroidMDMEnabled}}" === "true";
const MAC_MDM_ENABLED = "{{.MacMDMEnabled}}" == "true";
Expand Down Expand Up @@ -355,9 +355,11 @@ <h1 class="error-header">
const enrollSecret = getEnrollmentSecret();

const response = await fetch(
`${ANDROID_GET_TOKEN_URL}?enroll_secret=${enrollSecret}`,
`${ANDROID_GET_TOKEN_URL}?enroll_secret=${encodeURIComponent(
enrollSecret
)}`,
{
method: "POST",
method: "GET",
headers: {
"Content-Type": "application/json",
},
Expand Down Expand Up @@ -406,7 +408,7 @@ <h1 class="error-header">
// we need to get the token and then place it in the enroll link
try {
const data = await getEnrollmentToken();
renderContent();
renderContent(templateId);
if (!data.android_enrollment_url) {
throw new Error("Failed to get enrollment token");
}
Expand Down

0 comments on commit a4a2182

Please sign in to comment.