-
Notifications
You must be signed in to change notification settings - Fork 454
Expand file tree
/
Copy pathserver.Auth0Client.html
More file actions
29 lines (29 loc) · 41.3 KB
/
server.Auth0Client.html
File metadata and controls
29 lines (29 loc) · 41.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Auth0Client | @auth0/nextjs-auth0 - v4.4.2</title><meta name="description" content="Documentation for @auth0/nextjs-auth0"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@auth0/nextjs-auth0 - v4.4.2</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@auth0/nextjs-auth0</a></li><li><a href="../modules/server.html">server</a></li><li><a href="server.Auth0Client.html">Auth0Client</a></li></ul><h1>Class Auth0Client</h1></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d00c11b5446e7b84b3f7b5b39aec4c88ff3ee801/src/server/client.ts#L180">src/server/client.ts:180</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="server.Auth0Client.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="server.Auth0Client.html#getaccesstoken" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Access<wbr/>Token</span></a>
<a href="server.Auth0Client.html#getaccesstokenforconnection" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Access<wbr/>Token<wbr/>For<wbr/>Connection</span></a>
<a href="server.Auth0Client.html#getsession" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Session</span></a>
<a href="server.Auth0Client.html#middleware" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>middleware</span></a>
<a href="server.Auth0Client.html#startinteractivelogin" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>start<wbr/>Interactive<wbr/>Login</span></a>
<a href="server.Auth0Client.html#updatesession" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>Session</span></a>
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructorauth0client" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">Auth0Client</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?:</span> <a href="../interfaces/types.Auth0ClientOptions.html" class="tsd-signature-type tsd-kind-interface">Auth0ClientOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="server.Auth0Client.html" class="tsd-signature-type tsd-kind-class">Auth0Client</a><a href="#constructorauth0client" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/types.Auth0ClientOptions.html" class="tsd-signature-type tsd-kind-interface">Auth0ClientOptions</a><span class="tsd-signature-symbol"> = {}</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="server.Auth0Client.html" class="tsd-signature-type tsd-kind-class">Auth0Client</a></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d00c11b5446e7b84b3f7b5b39aec4c88ff3ee801/src/server/client.ts#L185">src/server/client.ts:185</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="getaccesstoken" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>Access<wbr/>Token</span><a href="#getaccesstoken" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="getaccesstoken-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getAccessToken</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">expiresAt</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">token</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span><a href="#getaccesstoken-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>getAccessToken returns the access token.</p>
<p>This method can be used in Server Components, Server Actions, and Route Handlers in the <strong>App Router</strong>.</p>
<p>NOTE: Server Components cannot set cookies. Calling <code>getAccessToken()</code> in a Server Component will cause the access token to be refreshed, if it is expired, and the updated token set will not to be persisted.
It is recommended to call <code>getAccessToken(req, res)</code> in the middleware if you need to retrieve the access token in a Server Component to ensure the updated token set is persisted.</p>
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">expiresAt</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">token</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d00c11b5446e7b84b3f7b5b39aec4c88ff3ee801/src/server/client.ts#L318">src/server/client.ts:318</a></li></ul></aside></div></li><li class=""><div class="tsd-signature tsd-anchor-link"><a id="getaccesstoken-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getAccessToken</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">req</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">NextRequest</span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterRequest.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterRequest</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">res</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">NextResponse</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterResponse.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterResponse</a><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">expiresAt</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">token</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span><a href="#getaccesstoken-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>getAccessToken returns the access token.</p>
<p>This method can be used in middleware and <code>getServerSideProps</code>, API routes in the <strong>Pages Router</strong>.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">req</span>: <span class="tsd-signature-type">NextRequest</span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterRequest.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterRequest</a></span></li><li><span><span class="tsd-kind-parameter">res</span>: <span class="tsd-signature-type">NextResponse</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterResponse.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterResponse</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">expiresAt</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">token</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d00c11b5446e7b84b3f7b5b39aec4c88ff3ee801/src/server/client.ts#L325">src/server/client.ts:325</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="getaccesstokenforconnection" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>Access<wbr/>Token<wbr/>For<wbr/>Connection</span><a href="#getaccesstokenforconnection" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="getaccesstokenforconnection-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getAccessTokenForConnection</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.AccessTokenForConnectionOptions.html" class="tsd-signature-type tsd-kind-interface">AccessTokenForConnectionOptions</a><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">expiresAt</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">token</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span><a href="#getaccesstokenforconnection-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Retrieves an access token for a connection.</p>
<p>This method can be used in Server Components, Server Actions, and Route Handlers in the <strong>App Router</strong>.</p>
<p>NOTE: Server Components cannot set cookies. Calling <code>getAccessTokenForConnection()</code> in a Server Component will cause the access token to be refreshed, if it is expired, and the updated token set will not to be persisted.
It is recommended to call <code>getAccessTokenForConnection(req, res)</code> in the middleware if you need to retrieve the access token in a Server Component to ensure the updated token set is persisted.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/types.AccessTokenForConnectionOptions.html" class="tsd-signature-type tsd-kind-interface">AccessTokenForConnectionOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">expiresAt</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">token</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d00c11b5446e7b84b3f7b5b39aec4c88ff3ee801/src/server/client.ts#L389">src/server/client.ts:389</a></li></ul></aside></div></li><li class=""><div class="tsd-signature tsd-anchor-link"><a id="getaccesstokenforconnection-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getAccessTokenForConnection</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.AccessTokenForConnectionOptions.html" class="tsd-signature-type tsd-kind-interface">AccessTokenForConnectionOptions</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">req</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">NextRequest</span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterRequest.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterRequest</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">res</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">NextResponse</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterResponse.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterResponse</a><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">expiresAt</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">token</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span><a href="#getaccesstokenforconnection-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Retrieves an access token for a connection.</p>
<p>This method can be used in middleware and <code>getServerSideProps</code>, API routes in the <strong>Pages Router</strong>.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/types.AccessTokenForConnectionOptions.html" class="tsd-signature-type tsd-kind-interface">AccessTokenForConnectionOptions</a></span></li><li><span><span class="tsd-kind-parameter">req</span>: <span class="tsd-signature-type">undefined</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">NextRequest</span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterRequest.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterRequest</a></span></li><li><span><span class="tsd-kind-parameter">res</span>: <span class="tsd-signature-type">undefined</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">NextResponse</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterResponse.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterResponse</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">expiresAt</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">token</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d00c11b5446e7b84b3f7b5b39aec4c88ff3ee801/src/server/client.ts#L398">src/server/client.ts:398</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="getsession" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>get<wbr/>Session</span><a href="#getsession" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="getsession-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getSession</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span> <span class="tsd-signature-symbol">|</span> <a href="../interfaces/types.SessionData.html" class="tsd-signature-type tsd-kind-interface">SessionData</a><span class="tsd-signature-symbol">></span><a href="#getsession-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>getSession returns the session data for the current request.</p>
<p>This method can be used in Server Components, Server Actions, and Route Handlers in the <strong>App Router</strong>.</p>
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span> <span class="tsd-signature-symbol">|</span> <a href="../interfaces/types.SessionData.html" class="tsd-signature-type tsd-kind-interface">SessionData</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d00c11b5446e7b84b3f7b5b39aec4c88ff3ee801/src/server/client.ts#L279">src/server/client.ts:279</a></li></ul></aside></div></li><li class=""><div class="tsd-signature tsd-anchor-link"><a id="getsession-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">getSession</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">req</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">NextRequest</span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterRequest.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterRequest</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span> <span class="tsd-signature-symbol">|</span> <a href="../interfaces/types.SessionData.html" class="tsd-signature-type tsd-kind-interface">SessionData</a><span class="tsd-signature-symbol">></span><a href="#getsession-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>getSession returns the session data for the current request.</p>
<p>This method can be used in middleware and <code>getServerSideProps</code>, API routes in the <strong>Pages Router</strong>.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">req</span>: <span class="tsd-signature-type">NextRequest</span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterRequest.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterRequest</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span> <span class="tsd-signature-symbol">|</span> <a href="../interfaces/types.SessionData.html" class="tsd-signature-type tsd-kind-interface">SessionData</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d00c11b5446e7b84b3f7b5b39aec4c88ff3ee801/src/server/client.ts#L286">src/server/client.ts:286</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="middleware" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>middleware</span><a href="#middleware" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="middleware-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">middleware</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">req</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">NextRequest</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">NextResponse</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#middleware-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>middleware mounts the SDK routes to run as a middleware function.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">req</span>: <span class="tsd-signature-type">NextRequest</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">NextResponse</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d00c11b5446e7b84b3f7b5b39aec4c88ff3ee801/src/server/client.ts#L270">src/server/client.ts:270</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="startinteractivelogin" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>start<wbr/>Interactive<wbr/>Login</span><a href="#startinteractivelogin" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="startinteractivelogin-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">startInteractiveLogin</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.StartInteractiveLoginOptions.html" class="tsd-signature-type tsd-kind-interface">StartInteractiveLoginOptions</a><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">NextResponse</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#startinteractivelogin-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/types.StartInteractiveLoginOptions.html" class="tsd-signature-type tsd-kind-interface">StartInteractiveLoginOptions</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">NextResponse</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d00c11b5446e7b84b3f7b5b39aec4c88ff3ee801/src/server/client.ts#L607">src/server/client.ts:607</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="updatesession" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>update<wbr/>Session</span><a href="#updatesession" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="updatesession-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">updateSession</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">req</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">NextRequest</span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterRequest.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterRequest</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">res</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">NextResponse</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterResponse.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterResponse</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">session</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.SessionData.html" class="tsd-signature-type tsd-kind-interface">SessionData</a><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#updatesession-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>updateSession updates the session of the currently authenticated user. If the user does not have a session, an error is thrown.</p>
<p>This method can be used in middleware and <code>getServerSideProps</code>, API routes, and middleware in the <strong>Pages Router</strong>.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">req</span>: <span class="tsd-signature-type">NextRequest</span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterRequest.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterRequest</a></span></li><li><span><span class="tsd-kind-parameter">res</span>: <span class="tsd-signature-type">NextResponse</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span> <span class="tsd-signature-symbol">|</span> <a href="../types/types.PagesRouterResponse.html" class="tsd-signature-type tsd-kind-type-alias">PagesRouterResponse</a></span></li><li><span><span class="tsd-kind-parameter">session</span>: <a href="../interfaces/types.SessionData.html" class="tsd-signature-type tsd-kind-interface">SessionData</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d00c11b5446e7b84b3f7b5b39aec4c88ff3ee801/src/server/client.ts#L500">src/server/client.ts:500</a></li></ul></aside></div></li><li class=""><div class="tsd-signature tsd-anchor-link"><a id="updatesession-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">updateSession</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">session</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/types.SessionData.html" class="tsd-signature-type tsd-kind-interface">SessionData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#updatesession-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>updateSession updates the session of the currently authenticated user. If the user does not have a session, an error is thrown.</p>
<p>This method can be used in Server Actions and Route Handlers in the <strong>App Router</strong>.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">session</span>: <a href="../interfaces/types.SessionData.html" class="tsd-signature-type tsd-kind-interface">SessionData</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/auth0/nextjs-auth0/blob/d00c11b5446e7b84b3f7b5b39aec4c88ff3ee801/src/server/client.ts#L511">src/server/client.ts:511</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#getaccesstoken" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Access<wbr/>Token</span></a><a href="#getaccesstokenforconnection" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Access<wbr/>Token<wbr/>For<wbr/>Connection</span></a><a href="#getsession" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Session</span></a><a href="#middleware" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>middleware</span></a><a href="#startinteractivelogin" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>start<wbr/>Interactive<wbr/>Login</span></a><a href="#updatesession" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>Session</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@auth0/nextjs-auth0 - v4.4.2</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>