In-app authentication lets people who are already signed in to your own web or mobile app open your learning paths, courses and portal without a second login. Your server creates a signed sign-in link for each user, and they land in your academy as themselves, so every learner's progress, scores and certificates are tracked.
Unlike a public link or an embed, only users of your product can get in, because only your server can create the link.
ℹ️ In-app authentication is available on the Customer Success plan. It needs a developer who can change your app's back-end code.
When to use it
You have your own product (not a third-party app) and can change its back-end code.
You want an in-product academy for onboarding, feature adoption or paid members.
You want to track each user's learning without asking them to sign up or verify an email.
Turn it on
Open your learning path and go to Settings › Learners' authentication.
Select In-app authentication.
Copy the sample code that appears. It already contains your workspace ID, your secret key and this path's ID.
The setting applies to every course in the learning path. You can also use it on:
A single course that isn't in a learning path: open the course and go to Settings › Learners' authentication. See Course Authentication: Set Access on a Single Course.
Your whole portal: go to Portal › In-app authentication. The portal then opens inside your product without its navigation bar and footer.
How it works
A signed-in user clicks Academy (or any link you choose) in your product.
Your server puts the user's details in a small data object and encrypts it with your secret key.
Your server sends the user to the sign-in link with that token, or loads it in an iframe.
The learner is signed in and lands on the right page. A new user becomes a learner automatically.
⚠️ Run this code on your server, never in front-end code. Anyone who has your secret key can sign in as any learner.
Sample code
This is the Node.js version shown in the admin. It uses the crypto-js library.
var CryptoJS = require("crypto-js");
var secretKey = CryptoJS.enc.Utf8.parse("YOUR_SECRET_KEY");
var shopId = "YOUR_WORKSPACE_ID";
function encryptData(data) {
var encrypted = CryptoJS.AES.encrypt(
CryptoJS.enc.Utf8.parse(JSON.stringify(data)),
secretKey,
{ mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }
);
return encodeURIComponent(encrypted.toString());
}
var data = {
username: "user_123", // required, your user's unique ID
email: "learner@company.com", // optional
name: "Jane Doe", // optional
courseCollectionId: "YOUR_PATH_ID", // optional
//courseCode: "YOUR_COURSE_CODE", // optional
//externalIds: ["onboarding"], // optional
//host: "https://learn.yourdomain.com" // optional
};
var magicLink = "https://gateway.minicoursegenerator.com/api/learner-auth/"
+ shopId + "/generate-magic-link?token=" + encryptData(data);
// Redirect the user to magicLink, or open it in an iframe.
💡 Create the link on your server each time a user opens the academy, and don't put it in your page source or share it. Anyone who has a link can open the academy as that user.
Data fields
Field | What it does |
| Required. A unique, stable ID for the user, such as their user ID in your product. The same username always opens the same learner. |
| Optional. Shown in your learner lists and reports. The name is used on certificates. |
| Optional. The learning path to open. It's in the sample code of that path. |
| Optional. Opens one course directly. The code is the end of the course link. |
| Optional list. Gives the learner access to every learning path or course whose External ID matches and that uses in-app authentication. Set the External ID in the in-app authentication panel. |
| Optional. Your custom domain, for example |
| Optional. Extra details about the user, such as |
Where the learner lands
Only
username: the learner's profile page.usernameandcourseCollectionId: the learning path page.username,courseCollectionIdandcourseCode: that course.usernameandexternalIds: the learner gets access to the matching paths and courses and lands on their profile page.
Show it inside your product
You can send the user to the link in a new tab, or show your academy inside your product with an iframe:
<iframe src="MAGIC_LINK" width="100%" height="100%" style="border:0" allowfullscreen></iframe>
Replace MAGIC_LINK with the link your server created for this user.
Use your own domain
Add host with your custom domain to the data, and the sign-in and your courses open on your domain. See Using Your Own Domain.
The first request still goes to gateway.minicoursegenerator.com, which redirects right away. If users shouldn't see that address at all, your server can call the link itself without following the redirect, and send the user straight to the address it returns.
FAQ
Where do I find my secret key?
It's in the sample code under Settings › Learners' authentication › In-app authentication, and in Portal › In-app authentication. It's the same key for your whole workspace. Keep it on your server only.
Why do users see "Magic link expires after it is clicked"?
The link sends the learner on to a sign-in address that works only once. If that address is bookmarked, reloaded or opened again, it shows this message. Send users through your server's link each time instead of saving the address they land on.
Does the learner keep their progress on other devices?
Yes. Progress belongs to the username, so as long as your server sends the same username, the learner continues where they left off on any device.
Can learners use in-app authentication and email verification on the same path?
No. A learning path or course has one access rule. If some of your learners aren't users of your product, put those courses in a separate learning path with another rule. See Enable access with Email verification.
What are the other access options?
❓ Please reach out via the Blue Chat bubble in the bottom right corner of your screen if you have any questions about in-app authentication.
