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");
9595
9696netlifyIdentity .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
9899});
99100
100101netlifyIdentity .open (); // open the modal
Original file line number Diff line number Diff line change @@ -71,9 +71,12 @@ const localHosts = {
7171 "0.0.0.0" : true
7272} ;
7373
74- function instantiateGotrue ( ) {
74+ function instantiateGotrue ( APIUrl ) {
7575 const isLocal = localHosts [ document . location . host . split ( ":" ) . shift ( ) ] ;
7676 const siteURL = isLocal && localStorage . getItem ( "netlifySiteURL" ) ;
77+ if ( APIUrl ) {
78+ return new GoTrue ( { APIUrl, setCookie : ! isLocal } ) ;
79+ }
7780 if ( isLocal && siteURL ) {
7881 const parts = [ siteURL ] ;
7982 if ( ! siteURL . match ( / \/ $ / ) ) {
@@ -175,8 +178,8 @@ function runRoutes() {
175178 }
176179}
177180
178- function init ( options ) {
179- options = options || { } ;
181+ function init ( options = { } ) {
182+ const { APIUrl } = options ;
180183 const controlEls = document . querySelectorAll (
181184 "[data-netlify-identity-menu],[data-netlify-identity-button]"
182185 ) ;
@@ -195,8 +198,8 @@ function init(options) {
195198 ) ;
196199 } ) ;
197200
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 ;
200203 iframe = document . createElement ( "iframe" ) ;
201204 iframe . id = "netlify-identity-widget" ;
202205 iframe . onload = ( ) => {
You can’t perform that action at this time.
0 commit comments