Create Deep Links to myTrailhead Content
After completing this unit, you’ll be able to:
- Explain how single sign-on authentication works with myTrailhead.
- Create a deep link that takes users directly to myTrailhead content.
At Pure Aloe, staffers use single sign-on (SSO) authentication: They log in once, using their Salesforce org credentials, and that gives them access to Salesforce and the other apps that the company uses.
Romina, the Pure Aloe learning and enablement professional, asks Joseph, the Pure Aloe admin, if employees can use SSO to log in to myTrailhead.
“Otherwise,” Romina says, “everyone would have to log in to Salesforce and myTrailhead separately, and that’s so inconvenient.”
Joseph loves it when answers are easy. He explains to Romina that he can create a deep link—or, “easy link”—to myTrailhead and put it on Pure Aloe’s SSO landing page. The link can take users straight to myTrailhead, just like other links on the landing page take users straight to Salesforce or any of the company’s other apps. Users can even put a deep link to myTrailhead in an email or a Chatter post.
Romina is delighted by this news. Wheels turn in her mind.
“Hey… you know what would be really great?” she says. “It would be really great if I could create a deep link that takes people straight to a particular module or trail. Is that possible?”
Joseph smiles. “It is! Let me show you how.”
Joseph knows that the deep link Romina is asking for has to accomplish a few things.
- It has to confirm that a user is authenticated via SSO.
- Then it has to take the user to the content.
- If a user isn’t yet authenticated via SSO, the link must first take the user to the login screen for myTrailhead.
- Then, after the user logs in, it has to take the user to the content.
- If a user hasn’t yet created a myTrailhead user account, the link must take the user to the account-registration flow.
- Then, after the user creates a profile and logs in, the link must take the user to the content.
“It sounds complicated,” he tells Romina. “But it isn’t. Let’s start with a link to a trail.”
Romina suggests the trail Navigate Your Pure Aloe Career, and Joseph finds it on Pure Aloe’s myTrailhead site.
https://purealoe.my.trailhead.com/content/purealoe/trails/navigate-your-pure-aloe-career
“To create a deep link, you build the part of the link that confirms whether a user is authenticated via SSO,” Joseph says. “Then you build the path to the content. For the path, you use everything in the URL that comes after ‘.com.’”
He points out to Romina the parts of the URL that are key to creating a deep link to the trail.
- Pure Aloe’s myTrailhead subdomain name—
purealoe.my.trailhead
- Pure Aloe’s namespace name—
purealoe
- The content type—
trails
- The content API name—
navigate-your-pure-aloe-career
“Not to go off topic,” Romina says, “but what’s an API name?”
Joseph explains that an API name is a unique ID that points to a piece of content. He indicates the URL on the trail page that he opened. “See, in this URL, the API name points to the Navigate Your Pure Aloe Career trail,” he says.
“Got it,” Romina answers.
Joseph starts building the deep link to the trail, starting with the part that confirms SSO authentication.
1. He begins with https://
and adds the online location of the relay service: trailblazer.me
.
https://trailblazer.me
2. He adds the relay prompt that kicks off SSO authentication: /relay?
https://trailblazer.me/relay?
3. To tell the relay where to go, he adds community=
and Pure Aloe’s myTrailhead subdomain name.
https://trailblazer.me/relay?community=purealoe.my.trailhead
4. After the subdomain name, he adds an ampersand (&
) to connect the parts of the URL.
https://trailblazer.me/relay?community=purealoe.my.trailhead&
5. Pure Aloe has My Domain set up in its Salesforce org, and that determines what Joseph adds next: He adds mydomain=
and then Pure Aloe’s My Domain name: purealoe
.
https://trailblazer.me/relay?community=purealoe.my.trailhead&mydomain=purealoe
Joseph pauses here. “OK. We just built the part of the link that confirms whether a user is authenticated through SSO,” he says. “Now we add the path to the trail.”
6. After the My Domain name, Joseph adds &path=/
.
https://trailblazer.me/relay?community=purealoe.my.trailhead&mydomain=purealoe&path=/
Joseph refers to the trail page that he opened at the beginning. He says to Romina, “Remember how I pointed out our namespace name, the content type, and the API name of the trail? Here’s where we use them.”
7. To create the path to the trail, he adds: content/
and:
- The Pure Aloe namespace name:
purealoe/
- The content type:
trails/
- The content API name:
navigate-your-pure-aloe-career
https://trailblazer.me/relay?community=purealoe.my.trailhead&mydomain=purealoe&path=/content/purealoe/trails/navigate-your-pure-aloe-career
“There you go,” Joseph says. He points to the deep link to the trail, which Romina can send to anyone at the company. "When users click the link, it makes sure that they're authenticated with SSO, and then it takes them to the trail."
“Fabulous!” Romina says. “How about if I want to create a deep link to a trailmix? Can I do that?”
Joseph knows she’s thinking about the Stay Secure trailmix that she created. It’s a required security training for everybody at the company.
“No problem,” he says. “Let’s do it.”
Joseph navigates to the Stay Secure trailmix on myTrailhead.
https://purealoe.my.trailhead.com/users/rominacinnamon/trailmixes/stay-secure
“OK. Everything’s the same as before, until we get to step 6,” he tells Romina.
1. Joseph follows the preceding steps 1 through 5 and builds the part of the link that confirms whether a user is authenticated via SSO.
https://trailblazer.me/relay?community=purealoe.my.trailhead&mydomain=purealoe
2. After the My Domain name, he adds &path=/
.
https://trailblazer.me/relay?community=purealoe.my.trailhead&mydomain=purealoe&path=/
3. To create the path, he copies everything in the URL after “.com” on the page with the trailmix: users/rominacinnamon/trailmixes/stay-secure
.
4. He pastes those details into the deep link.
https://trailblazer.me/relay?community=purealoe.my.trailhead&mydomain=purealoe&path=/users/rominacinnamon/trailmixes/stay-secure
“There you have it,” Joseph says. “There’s your deep link to the trailmix, incorporating a check for SSO authentication.”
Romina is thrilled, and Joseph’s myTrailhead configuration work is done.
- Blog Post: Using Single Sign-on with Trailhead
- Salesforce Help: API Names on myTrailhead
- Salesforce Help: My Domain
- Trailhead: Identity Basics
- Trailhead: Security Specialist