Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@auth0/auth0-react

Package Overview
Dependencies
Maintainers
42
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@auth0/auth0-react - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

15

CHANGELOG.md
# Change Log
## [v1.5.0](https://github.com/auth0/auth0-react/tree/v1.5.0) (2021-05-05)
**Added**
- Expose `handleRedirectCallback` [\#233](https://github.com/auth0/auth0-react/pull/233) ([stevehobbsdev](https://github.com/stevehobbsdev))
- Add TUser type param to useAuth0 hook [\#230](https://github.com/auth0/auth0-react/pull/230) ([Jameskmonger](https://github.com/Jameskmonger))
**Changed**
- Update User type [\#236](https://github.com/auth0/auth0-react/pull/236) ([tkiryu](https://github.com/tkiryu))
**Fixed**
- Check for state along with error param [\#231](https://github.com/auth0/auth0-react/pull/231) ([adamjmcgrath](https://github.com/adamjmcgrath))
## [v1.4.0](https://github.com/auth0/auth0-react/tree/v1.4.0) (2021-03-26)

@@ -4,0 +19,0 @@

6

dist/auth-state.d.ts

@@ -1,10 +0,10 @@

export declare type User = any;
import { User } from '@auth0/auth0-spa-js';
/**
* The auth state which, when combined with the auth methods, make up the return object of the `useAuth0` hook.
*/
export interface AuthState {
export interface AuthState<TUser extends User = User> {
error?: Error;
isAuthenticated: boolean;
isLoading: boolean;
user?: User;
user?: TUser;
}

@@ -11,0 +11,0 @@ /**

/// <reference types="react" />
import { BaseLoginOptions, GetIdTokenClaimsOptions, GetTokenSilentlyOptions, GetTokenWithPopupOptions, IdToken, LogoutOptions, LogoutUrlOptions, PopupLoginOptions, PopupConfigOptions, RedirectLoginOptions as Auth0RedirectLoginOptions } from '@auth0/auth0-spa-js';
import { BaseLoginOptions, GetIdTokenClaimsOptions, GetTokenSilentlyOptions, GetTokenWithPopupOptions, IdToken, LogoutOptions, LogoutUrlOptions, PopupLoginOptions, PopupConfigOptions, RedirectLoginOptions as Auth0RedirectLoginOptions, RedirectLoginResult, User } from '@auth0/auth0-spa-js';
import { AuthState } from './auth-state';

@@ -24,3 +24,3 @@ export interface RedirectLoginOptions extends BaseLoginOptions {

*/
export interface Auth0ContextInterface extends AuthState {
export interface Auth0ContextInterface<TUser extends User = User> extends AuthState<TUser> {
/**

@@ -130,2 +130,11 @@ * ```js

buildLogoutUrl: (options?: LogoutUrlOptions) => string;
/**
* After the browser redirects back to the callback page,
* call `handleRedirectCallback` to handle success and error
* responses from Auth0. If the response is successful, results
* will be valid according to their expiration times.
*
* @param url The URL to that should be used to retrieve the `state` and `code` values. Defaults to `window.location.href` if not given.
*/
handleRedirectCallback: (url?: string) => Promise<RedirectLoginResult>;
}

@@ -135,4 +144,4 @@ /**

*/
declare const Auth0Context: import("react").Context<Auth0ContextInterface>;
declare const Auth0Context: import("react").Context<Auth0ContextInterface<User>>;
export default Auth0Context;
//# sourceMappingURL=auth0-context.d.ts.map

@@ -114,3 +114,3 @@ import React from 'react';

/**
* The Id of an organization to log in to (Organizations is currently a Closed Beta).
* The Id of an organization to log in to.
*

@@ -117,0 +117,0 @@ * This will specify an `organization` parameter in your user's login request and will add a step to validate

@@ -6,4 +6,4 @@ export { default as Auth0Provider, Auth0ProviderOptions, AppState, } from './auth0-provider';

export { default as Auth0Context, Auth0ContextInterface, RedirectLoginOptions, } from './auth0-context';
export { PopupLoginOptions, PopupConfigOptions, GetIdTokenClaimsOptions, GetTokenWithPopupOptions, LogoutOptions, LogoutUrlOptions, CacheLocation, GetTokenSilentlyOptions, IdToken, } from '@auth0/auth0-spa-js';
export { PopupLoginOptions, PopupConfigOptions, GetIdTokenClaimsOptions, GetTokenWithPopupOptions, LogoutOptions, LogoutUrlOptions, CacheLocation, GetTokenSilentlyOptions, IdToken, User, } from '@auth0/auth0-spa-js';
export { OAuthError } from './errors';
//# sourceMappingURL=index.d.ts.map

@@ -1,6 +0,7 @@

import { AuthState, User } from './auth-state';
import { User } from '@auth0/auth0-spa-js';
import { AuthState } from './auth-state';
declare type Action = {
type: 'LOGIN_POPUP_STARTED';
} | {
type: 'INITIALISED' | 'LOGIN_POPUP_COMPLETE' | 'GET_ACCESS_TOKEN_COMPLETE';
type: 'INITIALISED' | 'LOGIN_POPUP_COMPLETE' | 'GET_ACCESS_TOKEN_COMPLETE' | 'HANDLE_REDIRECT_COMPLETE';
user?: User;

@@ -16,4 +17,4 @@ } | {

*/
export declare const reducer: (state: AuthState, action: Action) => AuthState;
export declare const reducer: (state: AuthState<User>, action: Action) => AuthState<User>;
export {};
//# sourceMappingURL=reducer.d.ts.map

@@ -0,1 +1,2 @@

import { User } from '@auth0/auth0-spa-js';
import { Auth0ContextInterface } from './auth0-context';

@@ -17,9 +18,11 @@ /**

* logout,
* } = useAuth0();
* } = useAuth0<TUser>();
* ```
*
* Use the `useAuth0` hook in your components to access the auth state and methods.
*
* TUser is an optional type param to provide a type to the `user` field.
*/
declare const useAuth0: () => Auth0ContextInterface;
declare const useAuth0: <TUser extends User = User>() => Auth0ContextInterface<TUser>;
export default useAuth0;
//# sourceMappingURL=use-auth0.d.ts.map
import React from 'react';
import { RedirectLoginOptions } from '@auth0/auth0-spa-js';
import { RedirectLoginOptions, User } from '@auth0/auth0-spa-js';
/**

@@ -50,2 +50,7 @@ * Options for the withAuthenticationRequired Higher Order Component

loginOptions?: RedirectLoginOptions;
/**
* Check the user object for JWT claims and return a boolean indicating
* whether or not they are authorized to view the component.
*/
claimCheck?: (claims?: User) => boolean;
}

@@ -52,0 +57,0 @@ /**

{
"author": "Auth0",
"name": "@auth0/auth0-react",
"version": "1.4.0",
"version": "1.5.0",
"description": "Auth0 SDK for React Single Page Applications (SPA)",

@@ -102,4 +102,4 @@ "keywords": [

"dependencies": {
"@auth0/auth0-spa-js": "^1.14.0"
"@auth0/auth0-spa-js": "^1.15.0"
}
}

@@ -106,2 +106,10 @@ # @auth0/auth0-react

If you're using TypeScript, you can pass a type parameter to `useAuth0` to specify the type of `user`:
```ts
const { user } = useAuth0<{ name: string }>();
user.name; // is a string
```
### Use with a Class Component

@@ -108,0 +116,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc