OAuth 2.0 Authorization Server
Secure OAuth 2.0 authentication for third-party applications. Enable "Sign in with LoopingBinary" in your app.
OAuth 2.0 compliant with industry-standard security
Subdomain isolation for optimal performance
No cookie conflicts with main application
Go to Developer Console and create an OAuth client. You'll receive a client_id and client_secret.
Redirect users to https://auth.loopingbinary.com/oauth/authorize with your client ID and callback URL.
const authUrl = `https://auth.loopingbinary.com/oauth/authorize?
client_id=${clientId}&
redirect_uri=${encodeURIComponent(callbackUrl)}&
response_type=code&
scope=read profile&
state=${randomState}`;
window.location.href = authUrl;On your backend, exchange the authorization code for an access token. Never do this in frontend code!
// Backend only!
const response = await fetch('https://app.loopingbinary.com/api/oauth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
grant_type: 'authorization_code',
code: authorizationCode,
redirect_uri: callbackUrl,
client_id: process.env.LB_CLIENT_ID,
client_secret: process.env.LB_CLIENT_SECRET
})
});All authentication endpoints are hosted on auth.loopingbinary.com to ensure no CORS issues. These endpoints use the same database as the main application and automatically set cross-subdomain cookies for seamless authentication.
https://auth.loopingbinary.com/api/auth/login/initInitiate passwordless login by sending a 6-digit code to user's email. All authentication endpoints are hosted on auth.loopingbinary.com to avoid CORS issues.
{
"email": "user@example.com"
}{
"message": "Login code sent to your email",
"emailSent": true,
"expiresInMinutes": 10,
"code": "123456"
}fetch('https://auth.loopingbinary.com/api/auth/login/init', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include', // Important: include cookies
body: JSON.stringify({
email: 'user@example.com'
})
})https://auth.loopingbinary.com/api/auth/login/verifyVerify the 6-digit code and receive authentication token. Sets cross-subdomain cookie automatically.
{
"email": "user@example.com",
"code": "123456"
}{
"token": "jwt_token_here",
"user": {
"id": "user_uuid",
"email": "user@example.com",
"fullName": "John Doe",
"role": "USER",
"roles": [
"USER"
],
"status": "ACTIVE"
}
}fetch('https://auth.loopingbinary.com/api/auth/login/verify', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include', // Important: include cookies
body: JSON.stringify({
email: 'user@example.com',
code: '123456'
})
})https://auth.loopingbinary.com/api/auth/login/resendResend login code if user didn't receive it or it expired.
{
"email": "user@example.com"
}{
"message": "Login code resent to your email",
"emailSent": true
}fetch('https://auth.loopingbinary.com/api/auth/login/resend', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({
email: 'user@example.com'
})
})https://auth.loopingbinary.com/api/auth/registerRegister a new user account (passwordless). Creates user and wallet automatically.
{
"email": "user@example.com",
"fullName": "John Doe",
"role": "USER"
}{
"emailSent": true,
"email": "user@example.com"
}fetch('https://auth.loopingbinary.com/api/auth/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({
email: 'user@example.com',
fullName: 'John Doe'
})
})OAuth authorization endpoints are on auth.loopingbinary.com, while token exchange and user info endpoints are on app.loopingbinary.com.
https://auth.loopingbinary.com/oauth/authorizeAuthorization consent screen - redirect users here to start OAuth flow
client_id(string)*- Your OAuth client IDredirect_uri(string)*- Your registered callback URLresponse_type(string)*- Must be "code"scope(string)- Space-separated scopes (e.g., "read profile")state(string)- CSRF protection tokenhttps://auth.loopingbinary.com/oauth/authorize?client_id=lb_xxx&redirect_uri=https://yourapp.com/callback&response_type=code&scope=read%20profile&state=xyz123https://app.loopingbinary.com/api/oauth/tokenExchange authorization code for access token (call from your backend)
{
"grant_type": "authorization_code",
"code": "authorization_code_from_callback",
"redirect_uri": "https://yourapp.com/callback",
"client_id": "your_client_id",
"client_secret": "your_client_secret"
}fetch('https://app.loopingbinary.com/api/oauth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
grant_type: 'authorization_code',
code: 'auth_code_here',
redirect_uri: 'https://yourapp.com/callback',
client_id: 'your_client_id',
client_secret: 'your_client_secret'
})
})https://app.loopingbinary.com/api/oauth/userinfoGet user information using access token
{
"Authorization": "Bearer {access_token}"
}fetch('https://app.loopingbinary.com/api/oauth/userinfo', {
headers: {
'Authorization': 'Bearer your_access_token'
}
})/api/auth/*) are on https://auth.loopingbinary.com - no CORS issues!https://auth.loopingbinary.com for authorization flowshttps://app.loopingbinary.com for token exchange and user info.loopingbinary.com)client_secret in frontend codestate parameter to prevent CSRF attackscredentials: 'include' in fetch requests to send cookies