DefinitelyTyped/types/discourse-sso/discourse-sso-tests.ts
Arnav Gupta bce8cdb6d3 more lint fixes
Signed-off-by: Arnav Gupta <arnav@codingblocks.com>
2018-05-12 16:16:43 +05:30

17 lines
432 B
TypeScript

import * as discourseSSO from 'discourse-sso';
const sso = new discourseSSO('sso secret string');
if (sso.validate('payload', 'sig')) {
const nonce = sso.getNonce('payload');
const userParams: discourseSSO.UserParams = {
nonce,
external_id: '1',
email: 'omg@mail.com',
username: 'myuser',
name: 'This Guy'
};
const loginString: string = sso.buildLoginString(userParams);
}