Application

Members

id : string

The Client ID of this application.

secret : string?

The Client Secret of this application.

scope : string

The OpenID scope of this application.

responseTypes : string[]

The OpenID response types of this application.

redirectUrls : string[]

The OpenID redirect URLs of this application.

postLogoutRedirectUrls : string[]?

The OpenID post logout redirect URLs of this application.

Methods

constructor(config)

Create a Vulos Application object based on a configuration object that has the following properties:

  • id: string (required): The Client ID of the Application (you can obtain this from the Vulos Identity dashboard by creating an application);

  • secret: string: The Client Secret of the Application (you can obtain this from the Vulos Identity dashboard by creating an application, non-applicable for browser applications that use the implicit flow);

  • scope: string (required): The OIDC scopes - "permissions" that your application has, they must match your application in the Vulos Identity dashboard.

  • redirectUrls: string[] (required): The URLs where Vulos Identity redirects after a user interaction;

  • postLogoutRedirectUrls: string[]: The URLs where Vulos Identity redirects after a successful logout;

  • responseTypes: string[]: The OIDC response types (defaults to ['code'] if a client secret is provided);

const application = new Application({
    // this is an example Client ID, replace with your own
    id: "796FZE9KLOLO0VSSBNOE",
    // this is an example Client Secret, replace with your own
    secret: "5a9b30a4f2f7f5edb5087e2258c3ecc0fc4129853e28f2f48f10b21b60388f1f",
    // this is an example scope string, modify according to your needs
    scope: "openid offline_access organization:manage",
    
    // change these URLs to match your site or application
    redirectUrls: [ "http://localhost/callback/login" ],
    postLogoutRedirectUrls: [ "http://localhost/callback/logout" ],
    
    // https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html
    responseTypes: [ "code" ]
})

createAuth(authApi, endpoint?)

Create an authentication object for this application based on a constructor specified in authApi that's provided by @vulos/identity-browser-sdk or @vulos/identity-node-sdk.

If an endpoint argument is provided, that will be used instead of the default Vulos Identity endpoint.

// If you intend to use this code in the frontend, 
// use "FrontendAuth" from "@vulos/identity-browser-sdk"
import { BackendAuth } from "@vulos/identity-node-sdk"

// ...

const auth = application.createAuth(BackendAuth)

See BaseAuth for more information.

Last updated