Updated types for authorizeUrl method (#40518)

This commit is contained in:
Leo Farias 2019-11-20 14:50:28 -05:00 committed by Sheetal Nandi
parent a6dd1a8042
commit 31bb520ddb
2 changed files with 39 additions and 38 deletions

View File

@ -1,7 +1,8 @@
// Type definitions for react-native-auth0 1.3
// Type definitions for react-native-auth0 2.0
// Project: https://github.com/auth0/react-native-auth0
// Definitions by: Andrea Ascari <https://github.com/ascariandrea>
// Mark Nelissen <https://github.com/marknelissen>
// Leo Farias <https://github.com/leoafarias>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@ -9,7 +10,7 @@
* Auth
*/
export interface AuthorizationUrlParams {
export interface AuthorizeUrlParams {
responseType: string;
redirectUri: string;
state: string;
@ -87,7 +88,7 @@ export type UserInfo<CustomClaims = {}> = {
} & CustomClaims;
export class Auth {
authorizationUrl(params: AuthorizationUrlParams): string;
authorizeUrl(params: AuthorizeUrlParams): string;
/* tslint:disable-next-line no-unnecessary-generics */
createUser<T>(user: CreateUserParams<T>): Promise<CreateUserResponse>;
exchange(params: ExchangeParams): Promise<string>;

View File

@ -1,41 +1,41 @@
import Auth0, { UserInfo } from "react-native-auth0";
import Auth0, { UserInfo } from 'react-native-auth0';
const auth0 = new Auth0({
domain: "definitely-typed",
clientId: "definitely-typed"
domain: 'definitely-typed',
clientId: 'definitely-typed',
});
auth0.auth.createUser({
email: "me@example.com",
username: "johndoe",
password: "password",
connection: "db-connection"
email: 'me@example.com',
username: 'johndoe',
password: 'password',
connection: 'db-connection',
});
auth0.auth.authorizationUrl({
responseType: "json",
redirectUri: "http://localhost:3000",
state: "my-state"
auth0.auth.authorizeUrl({
responseType: 'json',
redirectUri: 'http://localhost:3000',
state: 'my-state',
});
auth0.auth.exchange({
code: "my-code",
redirectUri: "http://localhost:3000",
verifier: "verifier"
code: 'my-code',
redirectUri: 'http://localhost:3000',
verifier: 'verifier',
});
auth0.auth.logoutUrl({
federated: true,
clientId: "client-id",
returnTo: "http://localhost:3000"
clientId: 'client-id',
returnTo: 'http://localhost:3000',
});
auth0.auth
.passwordRealm({
username: "me@example.com",
password: "password",
realm: "realm",
audience: "user-info"
username: 'me@example.com',
password: 'password',
realm: 'realm',
audience: 'user-info',
})
.then(res => {
if (res.refreshToken) {
@ -45,37 +45,37 @@ auth0.auth
});
auth0.auth.refreshToken({
refreshToken: "refresh-token",
scope: "openid"
refreshToken: 'refresh-token',
scope: 'openid',
});
auth0.auth.resetPassword({
email: "me@example.com",
connection: "db-connection"
email: 'me@example.com',
connection: 'db-connection',
});
auth0.auth.revoke({
refreshToken: "refresh-token"
refreshToken: 'refresh-token',
});
auth0.auth.userInfo({
token: "token"
token: 'token',
});
auth0.webAuth.authorize({
state: "state",
nonce: "nonce",
scope: "openid",
language: "en",
prompt: 'login'
state: 'state',
nonce: 'nonce',
scope: 'openid',
language: 'en',
prompt: 'login',
});
auth0.webAuth.clearSession({ federated: false });
auth0.webAuth.clearSession();
auth0.users("token").getUser({ id: "userId" });
auth0.users('token').getUser({ id: 'userId' });
auth0.users("token").patchUser<{ firstName: string; lastName: string }>({
id: "userId",
metadata: { firstName: "John", lastName: "Dow" }
auth0.users('token').patchUser<{ firstName: string; lastName: string }>({
id: 'userId',
metadata: { firstName: 'John', lastName: 'Dow' },
});