- Docs
- Connect your users
Start a sign-in
- 01Your appLinks to the sign-in URL
- 02Hosted sign-inThe user picks a service
- 03Music serviceThe user signs in
- 04Your return URLYou get the connected-user id
Build the URL
Use your account slug in the path. Signed in, the examples show your slug and your first return URL.
https://app.musicapi.com/{slug}?returnUrl={returnUrl}
The sign-in URL is a page, not an API call. Open it in the user's browser, a new tab, a popup, or a web view.
Skip the picker
Add the service id to the path to send the user straight to one service:
https://app.musicapi.com/{slug}/spotify/auth?returnUrl={returnUrl}
Use the integration type as the id: spotify, appleMusic, youtube, tidal, amazonMusic, deezer, soundCloud, boomplay, audiomack, audius, qobuz.
Query parameters
Where the user comes back to, success or failure. It must match one of your Accepted Return URLs (rules below).
Add a oneTimeToken to the callback. It lives 30 seconds and lets an app without a backend read the raw service tokens once. See Raw tokens and refresh.
A UUID v4 that you make. Poll the sign-in state with it while the user signs in. See Poll the sign-in status.
Send the user back to returnUrl at once when the sign-in fails. Without it, the hosted page shows the failure first.
Your own id for this user. It is added to the connected user's list of merchant ids (one connected user can carry several, if several of your users connect the same music account) and written on every usage record of that user, so you can match usage to your users.
Return URL rules
Add return URLs under Settings → Accepted Return URLs in the dashboard. A returnUrl is accepted when one entry matches all of these:
- The same scheme:
httpsmatches onlyhttps. A custom app scheme such asmyapp://works for mobile apps. - The same host. An entry
*.example.commatches every subdomain ofexample.com, but notexample.comitself. - The path starts with the entry's path. The entry
https://example.com/musicacceptshttps://example.com/music/callback.
Your verified custom domain counts as an accepted return URL on its own. A returnUrl that matches nothing fails with 400 and internalCode: 12 (InvalidReturnUrl).
Check a URL before you use it with GET/app/users/{slug}: with returnUrl it answers 400 when the URL does not match.
What happens next
The user comes back to returnUrl with a data64 query parameter. Read it in Handle the callback.