Added Auth0 definitions for JS API and widget

This commit is contained in:
AdvancedREI
2014-05-12 17:50:58 -07:00
parent 68fd50f64b
commit a52dade23e
5 changed files with 199 additions and 1 deletions
+18
View File
@@ -0,0 +1,18 @@
/// <reference path="../auth0/auth0.d.ts" />
/// <reference path="auth0.widget.d.ts" />
var widget: Auth0WidgetStatic = new Auth0Widget({
domain: 'mine.auth0.com',
clientID: 'dsa7d77dsa7d7',
callbackURL: 'http://my-app.com/callback',
callbackOnLocationHash: true
});
widget.signin({
connections: ['facebook', 'google-oauth2', 'twitter', 'Username-Password-Authentication'],
icon: 'https://contoso.com/logo-32.png',
showIcon: true
},
() => {
// The Auth0 Widget is now loaded.
});
+48
View File
@@ -0,0 +1,48 @@
// Type definitions for Auth0Widget.js
// Project: Auth0.com
// Definitions by: Robert McLaws <https://github.com/advancedrei>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../auth0/auth0.d.ts" />
interface Auth0WidgetStatic {
new(params: Auth0Constructor): Auth0WidgetStatic;
getClient(): Auth0Static;
getProfile(token: string, callback: Function): Auth0UserProfile;
parseHash(hash: string): Auth0DecodedHash;
reset(options: Auth0Options, callback?: Function): Auth0WidgetStatic;
signin(options: Auth0Options, widgetLoadedCallback?: Function, popupCallback?: Function): Auth0WidgetStatic;
signup(options: Auth0Options, callback: (error?: Auth0Error, profile?, id_token?, access_token?, state?) => any): Auth0WidgetStatic;
}
interface Auth0Constructor extends Auth0ClientOptions {
assetsUrl?: string;
cdn?: string;
dict?: any;
}
interface Auth0Options {
access_token?: string;
connections?: string[];
container?: string;
enableReturnUserExperience?: boolean;
extraParameters?: any;
icon?: string;
protocol?: string;
request_id?: string;
scope?: string;
showIcon?: boolean;
showForgot?: boolean;
showSignup?: boolean;
state?: any;
userPwdConnectionName?: string;
username_style?: string;
}
declare var Auth0Widget: Auth0WidgetStatic;
declare module "Auth0Widget" {
export = Auth0Widget
}