File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ const netlifyIdentity = require("netlify-identity-widget");
95
95
96
96
netlifyIdentity .init ({
97
97
container: " #netlify-modal" // defaults to document.body,
98
+ APIUrl: " https://some-identity-instance.example.com" // Set an absolute URL for the identity endpoint
98
99
});
99
100
100
101
netlifyIdentity .open (); // open the modal
Original file line number Diff line number Diff line change @@ -71,9 +71,12 @@ const localHosts = {
71
71
"0.0.0.0" : true
72
72
} ;
73
73
74
- function instantiateGotrue ( ) {
74
+ function instantiateGotrue ( APIUrl ) {
75
75
const isLocal = localHosts [ document . location . host . split ( ":" ) . shift ( ) ] ;
76
76
const siteURL = isLocal && localStorage . getItem ( "netlifySiteURL" ) ;
77
+ if ( APIUrl ) {
78
+ return new GoTrue ( { APIUrl, setCookie : ! isLocal } ) ;
79
+ }
77
80
if ( isLocal && siteURL ) {
78
81
const parts = [ siteURL ] ;
79
82
if ( ! siteURL . match ( / \/ $ / ) ) {
@@ -175,8 +178,8 @@ function runRoutes() {
175
178
}
176
179
}
177
180
178
- function init ( options ) {
179
- options = options || { } ;
181
+ function init ( options = { } ) {
182
+ const { APIUrl } = options ;
180
183
const controlEls = document . querySelectorAll (
181
184
"[data-netlify-identity-menu],[data-netlify-identity-button]"
182
185
) ;
@@ -195,8 +198,8 @@ function init(options) {
195
198
) ;
196
199
} ) ;
197
200
198
- store . init ( instantiateGotrue ( ) ) ;
199
- if ( options . hasOwnProperty ( " logo" ) ) store . modal . logo = options . logo ;
201
+ store . init ( instantiateGotrue ( APIUrl ) ) ;
202
+ if ( options . logo ) store . modal . logo = options . logo ;
200
203
iframe = document . createElement ( "iframe" ) ;
201
204
iframe . id = "netlify-identity-widget" ;
202
205
iframe . onload = ( ) => {
You can’t perform that action at this time.
0 commit comments