Skip to content

Commit

Permalink
fix: #45 switch to oidc-client-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
pamapa committed Oct 12, 2021
1 parent 8cba83d commit f7f2ec3
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 156 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
![Pipeline](https://github.com/authts/react-oidc-context/workflows/Release/badge.svg)


Lightweight auth library using the [oidc-client](https://github.com/IdentityModel/oidc-client-js) library for React single page applications (SPA).
Lightweight auth library using the [oidc-client-ts](https://github.com/authts/oidc-client-ts) library for React single page applications (SPA).
Support for [hooks](https://reactjs.org/docs/hooks-intro.html) and [higher-order components (HOC)](https://reactjs.org/docs/higher-order-components.html).


Expand All @@ -18,10 +18,10 @@ Support for [hooks](https://reactjs.org/docs/hooks-intro.html) and [higher-order


## Documentation
This library implements an auth context provider by making use of the `oidc-client` library. Its configuration is
This library implements an auth context provider by making use of the `oidc-client-ts` library. Its configuration is
tight coupled to that library.

- [oidc-client](https://github.com/IdentityModel/oidc-client-js/wiki)
- [oidc-client-ts](https://github.com/authts/oidc-client-ts)

The User and UserManager is hold in this context, which is accessible from the React application. Additionally it intercepts
the auth redirects by looking at the query/fragment parameters and acts accordingly. You still need to setup a redirect uri,
Expand Down Expand Up @@ -170,7 +170,7 @@ As **not** a child of `AuthProvider` (e.g. redux slice) when using local storage
containing an access token:
```jsx
// src/slice.js
import { User } from "oidc-client"
import { User } from "oidc-client-ts"

function getUser() {
const oidcStorage = localStorage.getItem(`oidc.user:<your authority>:<your client id>`)
Expand Down
26 changes: 16 additions & 10 deletions docs/react-oidc-context.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
```ts

import type { QuerySessionStatusArgs } from 'oidc-client-ts';
import { default as React_2 } from 'react';
import type { SessionStatus } from 'oidc-client';
import { User } from 'oidc-client';
import { UserManager } from 'oidc-client';
import { UserManagerSettings } from 'oidc-client';
import type { SessionStatus } from 'oidc-client-ts';
import type { SigninPopupArgs } from 'oidc-client-ts';
import type { SigninRedirectArgs } from 'oidc-client-ts';
import type { SigninSilentArgs } from 'oidc-client-ts';
import type { SignoutPopupArgs } from 'oidc-client-ts';
import type { SignoutRedirectArgs } from 'oidc-client-ts';
import { User } from 'oidc-client-ts';
import { UserManager } from 'oidc-client-ts';
import { UserManagerSettings } from 'oidc-client-ts';

// @public (undocumented)
export const AuthContext: React_2.Context<AuthContextProps>;
Expand All @@ -20,22 +26,22 @@ export interface AuthContextProps extends AuthState {
// (undocumented)
clearStaleState(): Promise<void>;
// (undocumented)
querySessionStatus(args?: any): Promise<SessionStatus>;
querySessionStatus(args?: QuerySessionStatusArgs): Promise<SessionStatus | null>;
// (undocumented)
removeUser(): Promise<void>;
// (undocumented)
revokeAccessToken(): Promise<void>;
readonly settings: UserManagerSettings;
// (undocumented)
signinPopup(args?: any): Promise<User>;
signinPopup(args?: SigninPopupArgs): Promise<User>;
// (undocumented)
signinRedirect(args?: any): Promise<void>;
signinRedirect(args?: SigninRedirectArgs): Promise<void>;
// (undocumented)
signinSilent(args?: any): Promise<User>;
signinSilent(args?: SigninSilentArgs): Promise<User | null>;
// (undocumented)
signoutPopup(args?: any): Promise<void>;
signoutPopup(args?: SignoutPopupArgs): Promise<void>;
// (undocumented)
signoutRedirect(args?: any): Promise<void>;
signoutRedirect(args?: SignoutRedirectArgs): Promise<void>;
// (undocumented)
startSilentRenew(): void;
// (undocumented)
Expand Down
149 changes: 41 additions & 108 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f7f2ec3

Please sign in to comment.