本文整理汇总了TypeScript中auth0-lock.show函数的典型用法代码示例。如果您正苦于以下问题:TypeScript show函数的具体用法?TypeScript show怎么用?TypeScript show使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Promise
return new Promise((resolve, reject) => {
lock.on('authenticated', (authResult) => {
if(authResult.error) {
return reject(authResult.error);
}
const { accessToken, idToken, refreshToken } = authResult;
lock.getUserInfo(accessToken, (error, profile) => {
if(error) {
return reject(error);
}
this.storage.store('profile', profile);
this.storage.store('idToken', idToken);
this.storage.store('accessToken', accessToken);
this.storage.store('refreshToken', refreshToken);
resolve();
});
});
lock.show();
});
示例2:
lock.on('authorization_error', (error) => {
lock.show({
flashMessage: {
type: 'error',
text: error.error_description
}
});
});
示例3: Promise
return new Promise((resolve: any, reject: any) => {
let options: any = {authParams: { scope: 'openid profile' }};
lock.show(options, function(err: any, profile: Profile, token: any) {
if (err) {
console.log(err);
return reject(err);
}
localStorage.setItem('id_token', token);
interceptor.registerAuthTokenInterceptor(token);
interceptor.registerUserInterceptor(profile.user_id);
model.setProfile(profile as Profile);
resolve();
});
});
示例4: moment
(state:IState)=> {
lock.show({
container: 'login-container',
connections: ['google-oauth2']
}, (err:any, p:any, t:string) => {
if (!err) {
const identity = ( p.identities || [] ).find(obj => p.user_id === `${obj.provider}|${obj.user_id}`);
const profile = Auth0Profile.fromJsonObj(p);
const idToken = t;
const expirationDate = moment().add(identity ? identity.expires_in : 30, 'second');
Actions.auth.next(saveStorage(idToken, expirationDate, profile));
}
});
return state;
}
示例5:
export const logIn = () => (dispatch) => {
lock.show()
}