@@ -31,7 +31,7 @@ Long version;
3131## Example
3232
3333``` tsx
34- import {AuthContext , AuthProvider , TAuthConfig , TRefreshTokenExpiredEvent } from " react-oauth2-code-pkce"
34+ import { AuthContext , AuthProvider , TAuthConfig , TRefreshTokenExpiredEvent } from " react-oauth2-code-pkce"
3535
3636const authConfig: TAuthConfig = {
3737 clientId: ' myClientID' ,
@@ -43,20 +43,20 @@ const authConfig: TAuthConfig = {
4343}
4444
4545const UserInfo = (): JSX .Element => {
46- const {token, tokenData} = useContext <IAuthContext >(AuthContext )
47-
48- return <>
49- <h4 >Access Token</h4 >
50- <pre >{ token } </pre >
51- <h4 >User Information from JWT</h4 >
52- <pre >{ JSON .stringify (tokenData , null , 2 )} </pre >
53- </>
46+ const {token, tokenData} = useContext <IAuthContext >(AuthContext )
47+
48+ return <>
49+ <h4 >Access Token</h4 >
50+ <pre >{ token } </pre >
51+ <h4 >User Information from JWT</h4 >
52+ <pre >{ JSON .stringify (tokenData , null , 2 )} </pre >
53+ </>
5454}
5555
5656ReactDOM .render (<AuthProvider authConfig = { authConfig } >
57- <UserInfo />
58- </AuthProvider >
59- , document .getElementById (' root' ),
57+ <UserInfo />
58+ </AuthProvider >
59+ , document .getElementById (' root' ),
6060)
6161```
6262
@@ -131,7 +131,7 @@ type TAuthConfig = {
131131 // Which URL the auth provider should redirect the user to after successful authentication/login
132132 redirectUri: string // Required
133133 // Which scopes to request for the auth token
134- scope? : string // Default : ''
134+ scope? : string // default : ''
135135 // Optional state value. Will often make more sense to provide the state in a call to the 'logIn()' function
136136 state? : string // default: null
137137 // Which URL to call for logging out of the auth provider
@@ -146,7 +146,7 @@ type TAuthConfig = {
146146 postLogin? : () => void // default: () => null
147147 // Which method to use for login. Can be 'redirect', 'replace', or 'popup'
148148 // Note that most browsers block popups by default. The library will print a warning and fallback to redirect if the popup is blocked
149- loginMethod: ' redirect' | ' replace' | ' popup' | ' native' // Default : 'redirect'
149+ loginMethod: ' redirect' | ' replace' | ' popup' | ' native' // default : 'redirect'
150150 // Optional callback function for the native login method. If loginMethod is set to 'native', this function,
151151 // which become required, will be called with the URL to open in the native browser(browser in app or somewhere else).
152152 // This is used to open the native login flow on mobile devices.
@@ -159,7 +159,7 @@ type TAuthConfig = {
159159 decodeToken? : boolean // default: true
160160 // By default, the package will automatically redirect the user to the login server if not already logged in.
161161 // If set to false, you need to call the "logIn()" function to log in (e.g. with a "Log in" button)
162- autoLogin? : boolean // Default : true
162+ autoLogin? : boolean // default : true
163163 // Store login state in 'localStorage' or 'sessionStorage'
164164 // If set to 'session', no login state is persisted by 'react-oauth2-code-pkce` when the browser closes.
165165 // NOTE: Many authentication servers will keep the client logged in by cookies. You should therefore use
@@ -186,7 +186,7 @@ type TAuthConfig = {
186186 // - 'absolute': The refresh token's expiration time is fixed from its initial issuance and does not change, regardless of how many times it is used.
187187 refreshTokenExpiryStrategy? : ' renewable' | ' absolute' // default: renewable
188188 // Whether or not to post 'scope' when refreshing the access token
189- refreshWithScope? : boolean // Default : true
189+ refreshWithScope? : boolean // default : true
190190 // Controls whether browser credentials (cookies, TLS client certificates, or authentication headers containing a username and password) are sent when requesting tokens.
191191 // Warning: Including browser credentials deviates from the standard protocol and can introduce unforeseen security issues. Only set this to 'include' if you know what
192192 // you are doing and CSRF protection is present. Setting this to 'include' is required when the token endpoint requires client certificate authentication, but likely is
@@ -220,20 +220,20 @@ This can be solved by marking the module with `use client` and importing the com
220220' use client'
221221import {useContext } from " react" ;
222222import dynamic from ' next/dynamic'
223- import {TAuthConfig , TRefreshTokenExpiredEvent , AuthContext } from ' react-oauth2-code-pkce'
223+ import {TAuthConfig ,TRefreshTokenExpiredEvent , AuthContext } from ' react-oauth2-code-pkce'
224224
225225const AuthProvider = dynamic (
226- () => import (" react-oauth2-code-pkce" )
227- .then ((mod ) => mod .AuthProvider ),
228- {ssr: false }
226+ () => import (" react-oauth2-code-pkce" )
227+ .then ((mod ) => mod .AuthProvider ),
228+ {ssr: false }
229229)
230230
231231const authConfig: TAuthConfig = {... for you to fill inn }
232232
233233export default function Authenticated() {
234- (<AuthProvider authConfig = { authConfig } >
235- <LoginInfo />
236- </AuthProvider >)
234+ (<AuthProvider authConfig = { authConfig } >
235+ <LoginInfo />
236+ </AuthProvider >)
237237}
238238```
239239
0 commit comments