Skip to content

Commit e7bdf60

Browse files
committed
Clarify why are adding this option.
1 parent c58aa6c commit e7bdf60

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ const netlifyIdentity = require("netlify-identity-widget");
9595

9696
netlifyIdentity.init({
9797
container: "#netlify-modal" // defaults to document.body,
98-
APIUrl: "https://some-identity-instance.example.com" // Set an absolute URL for the identity endpoint
9998
});
10099

101100
netlifyIdentity.open(); // open the modal
@@ -121,6 +120,23 @@ netlifyIdentity.logout();
121120
netlifyIdentity.gotrue;
122121
```
123122

123+
#### `netlifyIdentity.init([opts])`
124+
125+
You can pass an optional `opts` object to configure the widget when using the
126+
module api. Options include:
127+
128+
```js
129+
{
130+
container: "#some-query-selector"; // container to attach to
131+
APIUrl: "https://www.example.com/.netlify/functions/identity"; // Absolute url to endpoint. ONLY USE IN SPECIAL CASES!
132+
}
133+
```
134+
135+
Generally avoid setting the `APIUrl`. You should only set this when your app is
136+
served from a domain that differs from where the identity endpoint is served.
137+
This is common for Cordova or Electron apps where you host from localhost or a
138+
file.
139+
124140
## Localhost
125141

126142
When using the widget on localhost, it will prompt for your Netlify SiteURL the

0 commit comments

Comments
 (0)