mirror of
https://github.com/supabase/supabase.git
synced 2026-05-23 19:13:13 +08:00
189 lines
3.6 KiB
Plaintext
189 lines
3.6 KiB
Plaintext
---
|
|
id: auth-api-generatelink
|
|
title: "generateLink()"
|
|
slug: auth-api-generatelink
|
|
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supabase.yml
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabsPanel from '@theme/TabsPanel';
|
|
|
|
Generates links to be sent via email or other.
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
<ul className="method-list-group">
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
type
|
|
</span>
|
|
<span className="method-list-item-label-badge required">
|
|
required
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>signup</code> | <code>magiclink</code> | <code>recovery</code> | <code>invite</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
The link type ("signup" or "magiclink" or "recovery" or "invite").
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
email
|
|
</span>
|
|
<span className="method-list-item-label-badge required">
|
|
required
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>string</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
The user's email.
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
options
|
|
</span>
|
|
<span className="method-list-item-label-badge required">
|
|
required
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>object</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
No description provided.
|
|
|
|
</div>
|
|
|
|
<ul className="method-list-group">
|
|
<h5 class="method-list-title method-list-title-isChild expanded">Properties</h5>
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
data
|
|
</span>
|
|
<span className="method-list-item-label-badge false">
|
|
optional
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>object</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
No description provided.
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
password
|
|
</span>
|
|
<span className="method-list-item-label-badge false">
|
|
optional
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>string</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
No description provided.
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
|
|
<li className="method-list-item">
|
|
<h4 className="method-list-item-label">
|
|
<span className="method-list-item-label-name">
|
|
redirectTo
|
|
</span>
|
|
<span className="method-list-item-label-badge false">
|
|
optional
|
|
</span>
|
|
<span className="method-list-item-validation">
|
|
<code>string</code>
|
|
</span>
|
|
</h4>
|
|
<div class="method-list-item-description">
|
|
|
|
No description provided.
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
## Notes
|
|
|
|
- Requires a `service_role` key.
|
|
- This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
### Generate invite link.
|
|
|
|
|
|
|
|
<Tabs
|
|
defaultActiveId="js"
|
|
groupId="reference/supabase-js"
|
|
values={[{ label: 'JavaScript', value: 'js' }]}>
|
|
|
|
<TabsPanel id="js" label="js">
|
|
|
|
```js
|
|
const { data: user, error } = await supabase.auth.api.generateLink({
|
|
type: 'invite',
|
|
email: 'email@example.com'
|
|
})
|
|
```
|
|
|
|
|
|
</TabsPanel>
|
|
|
|
</Tabs> |