Entity Models

SDK includes entity models to make it simple to generate responses for such endpoints.

import { Models } from "@ssofy/node-sdk";
...
const client = <Models.ClientEntity>{
    id             : 'my-web-app', // required
    name           : 'My App Name', // required
    secret         : 'CLIENT SECRET KEY',
    redirect_uris  : ['*'], // wildcard is supported but not recommended.
    icon           : 'https://example.com/icon.png',
    theme          : 'default',
    tos            : 'https://example.com/tos',
    privacy_policy : 'https://example.com/privacy-policy',
    confidential   : true,
};

return client;
import { Models } from "@ssofy/node-sdk";
...
const scopes = [
    <Models.ScopeEntity>{
        id: '*', // required
        title: 'Read and Write all data.', // required
        description: null,
        icon: 'fa-id-card',
        url: null,
    },
    <Models.ScopeEntity>{
        id: 'profile', // required
        title: 'Your profile information including name, birthday.', // required
        description: 'Click <a href="https://example.com/profile-privacy">here</a> to read more about the data privacy.',
        icon: 'fa-id-card',
        url: null,
    },
];

return scopes;
import { Models } from "@ssofy/node-sdk";
...
const user = <Models.UserEntity>{
    id: '1', //required
    hash: '1', //required
    display_name: 'j.walsh@example.com', 
    name: 'Jessica Walsh',
    picture: 'https://i.pravatar.cc/48',
    profile: 'https://example.com/profile?id=1',
    username: 'j.walsh',
    email: 'j.walsh@example.com',
    email_verified: true,
    phone: '+441234567890',
    phone_verified: true,
    given_name: null,
    middle_name: null,
    family_name: null,
    nickname: null,
    website: null,
    gender: 'female',
    birthdate: null,
    address: null,
    location: null,
    zoneinfo: null,
    locale: null,
    custom_1: null,
    custom_2: null,
    custom_3: null,
    custom_4: null,
    custom_5: null,
    custom_6: null,
    custom_7: null,
    custom_8: null,
    custom_9: null,
    additional: {
        country: 'UK',
    },
};

return user;
import { Models } from "@ssofy/node-sdk";
...
const otpOptions = [
    <Models.OTPOptionEntity>{
        id     : 'user1-authorization-email-j.walsh@example.com', //required
        type   : 'email', //required
        to     : 'j.walsh@example.com', //required
        hint   : 'j*****h@*****le.com', //required
        user_id: 'user1', //required
        action : 'authorization', //required
    },
];

return otpOptions;
import { Models } from "@ssofy/node-sdk";
...
const token = <Models.TokenEntity>{
    token: 'sKmR4BOoaS7bKkKD16uzX71syKLESft4', //required
    ttl:   60 * 60, //required
};

return token;
import { Models } from "@ssofy/node-sdk";
...
const authResponse = <Models.AuthResponseEntity>{
    user:  authenticatedUser, //required
    token: generatedPasswordlessToken, //required
};

return authResponse;
ssofy Knowledge Base
At our core, we believe that staying up-to-date with the latest trends and advancements in Authentication and related areas is essential. That's why we take great pride in keeping you informed with the latest insights, updates, and news in this rapidly evolving landscape.


Do you need support?
SSOfy is by Cubelet Ltd.
Copyright © 2024 Cubelet Ltd. All rights reserved.