Files
supabase/apps/temp-docs/docs/reference/javascript/auth-api-sendmobileotp.mdx
2022-04-26 14:17:19 +02:00

79 lines
1.3 KiB
Plaintext

---
id: auth-api-sendmobileotp
title: "sendMobileOTP()"
slug: auth-api-sendmobileotp
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supabase.yml
---
import Tabs from '@theme/Tabs';
import TabsPanel from '@theme/TabsPanel';
Sends a mobile OTP via SMS. Will register the account if it doesn't already exist
## Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
phone
</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 phone number WITH international prefix
</div>
</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
### Basic example.
<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
.sendMobileOTP('12345879')
```
</TabsPanel>
</Tabs>