• How it works
  • Partners
  • Blog
  • Docs
  • Sign up
  • Client Area

Ad Publishers

  • Getting started with Ads – Common Issues & FAQs
  • Payment & Fee FAQs
  • Setting up your ads.txt file
  • Installing the ad script on your page
  • Creating an ad placement
  • US Privacy law compliance steps
  • Ad script lifecycle events
  • Detecting ad-blocking users
  • Special ad format: Sticky Stack
  • Placement Configuration API

CMP

  • Adding custom consents or disclosures
  • Creating a link for the user to manage their consents

Sponsor

  • Getting started with Sponsor

Users

  • Getting started with Users
  • Adding the Users SDK to your site
  • Initializing the Users SDK
  • Launching the login/registration screen
  • Managing user sessions
  • Users SDK API Reference
  • NitroPay
  • Docs
  • Users
  • Initializing the Users SDK

Initializing the Users SDK

An Auth instance is first required in order to create the UserClient needed to interact with the SDK.

Websites that are loading the CDN copy of Users can implement a very basic vanilla JavaScript connection with the following code snippet.

<script type="text/javascript">
var auth = null;
var users = null;

window['nitroAuth'].init({
  clientId: 'YourClientId',
  scope: 'openid offline',
}, window.localStorage, function(a) {
  auth = a;

  window['nitroUsers'].init(auth, function(u) {
    users = u;

    // UserClient and Auth are now available!
  });
});
</script>

A JavaScript module application could accomplish the same thing like this.

import { Auth } from '@nitropay/sdk/src/auth';
import { UsersClient } from '@nitropay/sdk/src/users';

const auth = new Auth({
  clientId: 'YourClientID', 
  scope: 'openid offline' 
});
const users = new UsersClient(auth);
Share this document:
  • Facebook
  • Twitter
  • LinkedIn
Updated on January 25, 2023
Adding the Users SDK to your siteLaunching the login/registration screen
© GG Software, LP
Privacy Policy | Terms of Use | Contact us