Adding dynamic URLs
This commit is contained in:
Родитель
bdaee10c76
Коммит
f2ec0dfa7f
26
app.js
26
app.js
|
@ -298,15 +298,25 @@ docsapp.addPreRender(overrideIfClientInQsForPublicAllowedUrls);
|
|||
docsapp.addPreRender(appendTicket);
|
||||
docsapp.addPreRender(embedded);
|
||||
docsapp.addPreRender(function(req,res,next){
|
||||
if(process.env.NODE_ENV === 'production') {
|
||||
res.locals.uiURL = 'https://' + nconf.get('DOMAIN_URL_APP');
|
||||
res.locals.sdkURL = 'https://' + nconf.get('DOMAIN_URL_SDK');
|
||||
res.locals.widget_url = nconf.get('LOGIN_WIDGET_URL');
|
||||
} else {
|
||||
res.locals.uiURL = 'http://' + nconf.get('DOMAIN_URL_APP');
|
||||
res.locals.sdkURL = 'http://' + nconf.get('DOMAIN_URL_SDK');
|
||||
res.locals.widget_url = nconf.get('LOGIN_WIDGET_URL');
|
||||
var scheme = process.env.NODE_ENV === 'production' ? 'https' : 'http';
|
||||
|
||||
res.locals.uiURL = scheme + '://' + nconf.get('DOMAIN_URL_APP');
|
||||
res.locals.sdkURL = scheme + '://' + nconf.get('DOMAIN_URL_SDK');
|
||||
|
||||
function removeScheme(url) {
|
||||
return url.slice(url.indexOf(':') + 1);
|
||||
}
|
||||
|
||||
// Auth0 client side Javascript URLs to use
|
||||
res.locals.auth0js_url = nconf.get('AUTH0JS_URL');
|
||||
res.locals.auth0js_url_no_scheme = removeScheme(nconf.get('AUTH0JS_URL'));
|
||||
|
||||
res.locals.auth0_angular_url = nconf.get('AUTH0_ANGULAR_URL');
|
||||
res.locals.auth0_angular_url_no_scheme = removeScheme(nconf.get('AUTH0_ANGULAR_URL'));
|
||||
|
||||
res.locals.widget_url = nconf.get('LOGIN_WIDGET_URL');
|
||||
res.locals.widget_url_no_scheme = removeScheme(nconf.get('LOGIN_WIDGET_URL'));
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ If you already have an existing application, please follow the steps below.
|
|||
<script src="//code.angularjs.org/1.2.16/angular-cookies.min.js"></script>
|
||||
|
||||
<!-- Auth0 widget script and AngularJS module -->
|
||||
<script src="//cdn.auth0.com/w2/auth0-widget-4.0.js"></script>
|
||||
<script src="//cdn.auth0.com/w2/auth0-angular-0.4.js"> </script>
|
||||
<script src="@@widget_url_no_scheme@@"></script>
|
||||
<script src="@@auth0_angular_url_no_scheme@@"> </script>
|
||||
|
||||
<!-- Setting the right viewport -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
|
|
|
@ -24,7 +24,7 @@ Notice that `color` and `food` are custom fields and we will be storing them too
|
|||
### 2. Add the Auth0 Widget to it
|
||||
|
||||
```html
|
||||
<script src="https://cdn.auth0.com/w2/auth0-widget-2.4.0.min.js"></script>
|
||||
<script src="@@widget_url_no_scheme@@"></script>
|
||||
```
|
||||
|
||||
```js
|
||||
|
|
|
@ -161,7 +161,7 @@ Next step is to add a Login Page (`/login.jsp`) with the custom widget of the pr
|
|||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<title>Login</title>
|
||||
<script src="https://cdn.auth0.com/w2/auth0-widget-2.4.0.min.js"></script>
|
||||
<script src="@@widget_url_no_scheme@@"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -25,8 +25,8 @@ Otherwise, Please follow the steps below to configure AngularJS to use it with A
|
|||
<script src="//code.angularjs.org/1.2.16/angular-cookies.min.js"></script>
|
||||
|
||||
<!-- Auth0 widget script and AngularJS module -->
|
||||
<script src="//cdn.auth0.com/w2/auth0-widget-4.js"></script>
|
||||
<script src="//cdn.auth0.com/w2/auth0-angular-0.4.js"> </script>
|
||||
<script src="@@widget_url_no_scheme@@"></script>
|
||||
<script src="@@auth0_angular_url_no_scheme@@"> </script>
|
||||
|
||||
<!-- Setting the right viewport -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
|
|
|
@ -22,7 +22,7 @@ Otherwise, please follow the steps below to configure your app to use jQuery wit
|
|||
|
||||
````html
|
||||
<!-- Auth0 widget script -->
|
||||
<script src="//cdn.auth0.com/w2/auth0-widget-4.js"></script>
|
||||
<script src="@@widget_url_no_scheme@@"></script>
|
||||
|
||||
<!-- Setting the right viewport -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
|
|
|
@ -10,7 +10,7 @@ Please follow the steps below to configure your JS app to use Auth0.
|
|||
|
||||
````html
|
||||
<!-- Auth0 widget script -->
|
||||
<script src="//cdn.auth0.com/w2/auth0-widget-4.js"></script>
|
||||
<script src="@@widget_url_no_scheme@@"></script>
|
||||
|
||||
<!-- Setting the right viewport -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
1. Add a new JavaScript to your Unbounce landing page and replace the Auth0 domain and client id with the values you've got from Auth0. Also make sure to check jQuery as a dependency.
|
||||
|
||||
```
|
||||
<script src="http://cdn.auth0.com/w2/auth0-2.1.js"></script>
|
||||
<script src="@@auth0js_url_no_scheme@@"></script>
|
||||
<script type="application/javascript">
|
||||
|
||||
var auth0 = new Auth0({
|
||||
|
|
Загрузка…
Ссылка в новой задаче