ReatJS Getting Started

This will guide you through setting up and managing authentication and authorization in your JavaScript apps using cidaas SDK.

Click here for Sample Project.

First Get Your Credentials

Once you are registered with cidaas, you can able to create your own Apps. Register with cidaas at www.cidaas.com and click on Try Now. Click here to know the steps to create Application.

There are some App/Client-details that your application (web portal for e.g.) needs to know about, in order to properly communicate with cidaas, including your Client ID and Client Secret. You can retrieve these values from the settings area for your Application in the cidaas App Settings page.

Setup Your Callback URLs

Basically a callback URL gives directions to an external system on where to go next. What is at that URL could be anything.

You need to whitelist a callback URL for your app in the Callback URLs field in your Client Settings. If no callback URLs are set, a mismatch error will be displayed when a user logs in.

The Callback URL should be set like

http://www.myhostname.com, http://localhost:9000

Scope Management

Basically a scope management gives additional level of permissions or access rights for each user,as per the business requirements of the customer, using the scope - parameter.

cidaas checks to ensure that the defined scope matches with the actual scope allowed for the user, and appropriately grants access to the registered/logged in user.

Click here to know the steps to setup Scope Management.

Getting Script

Once you created the Application successfully, you will get the script of your application from our cidaas AdminUI.

Install Cidaas SDK

Integrate your application with cidaas you requires our cidaas_sdk.js library. You can retrieve this library from cidaas CDN.

Copy the script from your adminUI and paste it in the code block of your web App

<script type = "text/javascript">
if (typeof window.cidaas !=='object')
{
window.cidaas = {};
}
cidaas.client_id = '<<app_client_id>>';
cidaas.login_redirect_url = '<<app_login_redirect_url>>';
cidaas.register_redirect_url = '<<app_register_redirect_url>>';
cidaas.response_type = '<<app_response_type>>';
cidaas.mode = '<<app_mode>>';
cidaas.extra_queries = '<<app_extra_queries>>';
cidaas.service_url = '<<app_service_url>>';
cidaas.userinfo_callback = function(userinfo)
{
};
</script>
<script type="text/javascript" src="https://cdn.cidaas.de/javascript/test/cidaas_sdk.js">
</script>

Secure Login and Register

You can simply call the ​doLogin() method where you want to implement the ​login​ functionality. For window mode Login you can call the​doWindowLogin(width,height) method.

<button onclick="doLogin()">Login</button>

The login functionality will work with the scope cidaas:login , this scope will add default when you create a new Application.

You can simply call the ​doRegister() method where you want to implement the ​register​ functionality. For window mode Registration you can call the doWindowRegister(width,height)​ method.

<button onclick="doRegister()">Register</button>

similar to the Login functionality, Register also works with the scope of cidaas:register.

User Profile

This method is used for retrieving user information after receiving an access_token. This method call is optional and can be used for e.g.: for displaying user information, such as the name of a user, in the UI.

You can simply call the cidaas.userinfo_callback(userinfo) method to retrieve the user personal information as JSON fromat.

cidaas.userinfo_callback = function (userinfo) {};

Logout

The logout method is used for invoking logout, or to end access to your website. Here, the access token that was used for logging in, will be declared as invalid and blocked by the cidaas system for any further use.

You can simply call the doLogout() method to inform that the current user login session has ended.

<button onclick="doLogout()">Logout</button>

results matching ""

    No results matching ""