# Getting error with Safari

**URL:** <https://community.auth0.com/t/getting-error-with-safari/12795>\
**Category:** JWT.io\
**Tags:** lock\
**Created:** [July 4, 2018, 7:57am UTC](https://community.auth0.com/t/getting-error-with-safari/12795 "2018-07-04T07:57:27Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![umeshkolhe.89](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@umeshkolhe.89](https://community.auth0.com/u/umeshkolhe.89)\
**Post date:** [July 4, 2018, 7:57am UTC](https://community.auth0.com/t/getting-error-with-safari/12795/1 "2018-07-04T07:57:27Z")

</div>

We are getting error with Safari, while we are used the “angular2-jwt and lock 11.7.2”.  
Safari shows “ReferenceError: Can’t find variable: Auth0Lock”  
I’ve seen a similar post, but no solutions that worked for me.  
I hope someone can help me with it.

Thank you

---

<div class="post-metadata">

**Author:** ![kimcodes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kimcodes/32/81052_2.png) [@kimcodes](https://community.auth0.com/u/kimcodes)\
**Post date:** [July 4, 2018, 1:51pm UTC](https://community.auth0.com/t/getting-error-with-safari/12795/2 "2018-07-04T13:51:31Z")

</div>

👋 @umeshkolhe.89 the error seems like a common one where it hasn’t been loaded before the script is run. Is this a new application you created ? Can you share your configuration?

---

<div class="post-metadata">

**Author:** ![umeshkolhe.89](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@umeshkolhe.89](https://community.auth0.com/u/umeshkolhe.89)\
**Post date:** [July 5, 2018, 10:25am UTC](https://community.auth0.com/t/getting-error-with-safari/12795/3 "2018-07-05T10:25:34Z")

</div>

Greetings of the day…!!!

Thanks for the reply.  
Yes we are created a new application.

please refer below configuration :

1. configuration of variable  
========================================================================================

interface AuthConfig {  
clientID: string;  
domain: string;  
callbackURL: string;  
options: object;  
}

# export const AUTH\_CONFIG: AuthConfig = { clientID: ‘here we used the clientID’, domain: ‘here we used the domain’, callbackURL: CONSTANTS.MAIN.APP.MAIN\_URL.BASE\_URL, options: { autoclose: true, autofocus: true, closable: true, rememberLastLogin: false, allowForgotPassword: true, allowSignUp: false, audience: ‘https://${AUTH\_CONFIG.domain}/userinfo’, auth: { redirectUrl: CONSTANTS.MAIN.APP.MAIN\_URL.BASE\_URL + ‘login/’, responseType: ‘token’ }, theme: { logo: CONSTANTS.MAIN.APP.MAIN\_URL.BASE\_URL + ‘assets/resources/logo\_small.png’, primaryColor: ‘#1e2e38’, }, languageDictionary: { title: “Sign In”, loginSubmitLabel: “Sign In”, forgotPasswordAction: “I forgot my password.”, forgotPasswordColor: “red”, error: { login: { “lock.invalid\_email\_password”: “Wrong email or password.” }, } }, } };

1. Detail of an Implementation  
========================================================================================

import { AUTH\_CONFIG } from ‘./auth0-variables’;  
import { tokenNotExpired } from ‘angular2-jwt’;  
declare var Auth0Lock: any;

@Injectable()  
export class AuthService implements OnInit {  
lock = new Auth0Lock(  
AUTH\_CONFIG.clientID,  
AUTH\_CONFIG.domain,  
AUTH\_CONFIG.options  
);

constructor(public router: Router, private \_http: HttpService, private dataService: DataService, private loaderService: LoaderService,  
private logger: Logger, private authUserService: AuthUserService) {  
this.lock.on(“authenticated”, function(authResult) {  
localStorage.setItem(‘expires\_at’, authResult.idTokenPayload.exp);  
localStorage.setItem(‘access\_token’, authResult.accessToken);  
localStorage.setItem(‘id\_token’, authResult.idToken);  
authUserService.getLoggedUserData();  
});  
}

public login(): void {  
// this.auth0.authorize();  
localStorage.clear();  
this.lock.show();  
}

public logout(): void {  
localStorage.removeItem(‘access\_token’);  
localStorage.removeItem(‘id\_token’);  
localStorage.removeItem(‘expires\_at’);  
this.router.navigate([‘/’]);  
}

public authenticated(): boolean {  
return tokenNotExpired();  
}  
}

Please let me know the correct implementation.

Thank you

---

<div class="post-metadata">

**Author:** ![umeshkolhe.89](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@umeshkolhe.89](https://community.auth0.com/u/umeshkolhe.89)\
**Post date:** [July 9, 2018, 5:00am UTC](https://community.auth0.com/t/getting-error-with-safari/12795/4 "2018-07-09T05:00:55Z")

</div>

Hi @kimcodes ,

Could you please help me for solving the issue.

Above is the code configuration.

Regards,  
Umesh

---

<div class="post-metadata">

**Author:** ![kimcodes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kimcodes/32/81052_2.png) [@kimcodes](https://community.auth0.com/u/kimcodes)\
**Post date:** [July 9, 2018, 1:12pm UTC](https://community.auth0.com/t/getting-error-with-safari/12795/5 "2018-07-09T13:12:11Z")

</div>

👋 can you try importing Lock into your implementation with something like `import Auth0Lock from 'auth0-lock'; ` or `let Auth0Lock = require('auth0-lock').default;`

---

<div class="post-metadata">

**Author:** ![umeshkolhe.89](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@umeshkolhe.89](https://community.auth0.com/u/umeshkolhe.89)\
**Post date:** [July 10, 2018, 6:59am UTC](https://community.auth0.com/t/getting-error-with-safari/12795/6 "2018-07-10T06:59:51Z")

</div>

Thanks for the reply

Yes we had tried above implementation but getting error as follows:  
**Error: Unexpected token \<**  
This error display in all browser as well.

please provide concrete solution we are waiting for your reply.

Thanks

---

<div class="post-metadata">

**Author:** ![kimcodes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kimcodes/32/81052_2.png) [@kimcodes](https://community.auth0.com/u/kimcodes)\
**Post date:** [July 10, 2018, 12:48pm UTC](https://community.auth0.com/t/getting-error-with-safari/12795/7 "2018-07-10T12:48:42Z")

</div>

@umeshkolhe.89 Do you have any [Rules](https://auth0.com/docs/rules/current) or [Database Scripts](https://auth0.com/docs/connections/database/custom-db#create-database-action-scripts) configured for your application?

---

<div class="post-metadata">

**Author:** ![umeshkolhe.89](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@umeshkolhe.89](https://community.auth0.com/u/umeshkolhe.89)\
**Post date:** [July 11, 2018, 7:19am UTC](https://community.auth0.com/t/getting-error-with-safari/12795/8 "2018-07-11T07:19:39Z")

</div>

Hi @kimcodes,

We do not configured any rule or Database Script in my application.

We are getting another issue in lock.min.js which we uses version 11.7.2

Please find below console error:  
**TypeError: ‘undefined’ is not an object (evaluating ‘a.length’)**

please provide more detail to solve the issue.

Thanks

---

<div class="post-metadata">

**Author:** ![umeshkolhe.89](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@umeshkolhe.89](https://community.auth0.com/u/umeshkolhe.89)\
**Post date:** [July 16, 2018, 10:26am UTC](https://community.auth0.com/t/getting-error-with-safari/12795/9 "2018-07-16T10:26:36Z")

</div>

Hi @kimcodes,

please provide valid input based on that we can change our code base.

Regards,  
Umesh

---

<div class="post-metadata">

**Author:** ![umeshkolhe.89](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@umeshkolhe.89](https://community.auth0.com/u/umeshkolhe.89)\
**Post date:** [July 19, 2018, 6:28am UTC](https://community.auth0.com/t/getting-error-with-safari/12795/10 "2018-07-19T06:28:11Z")

</div>

Hi @kimcodes,

Can I use lock.js instead of using lock.min.js of version 11.7.2

please provide your suggestion.

Regards  
Umesh

---

<div class="post-metadata">

**Author:** ![umeshkolhe.89](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@umeshkolhe.89](https://community.auth0.com/u/umeshkolhe.89)\
**Post date:** [July 24, 2018, 6:16am UTC](https://community.auth0.com/t/getting-error-with-safari/12795/11 "2018-07-24T06:16:56Z")

</div>

Hi @kimcodes,

I have successfully login into a safari browser but “Not secure” message on the top left side of url.

This message only comes up in safari browser.

could you please help me to how to secure the application .

Regards,  
Umesh

---

<div class="post-metadata">

**Author:** ![kimcodes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kimcodes/32/81052_2.png) [@kimcodes](https://community.auth0.com/u/kimcodes)\
**Post date:** [July 24, 2018, 2:14pm UTC](https://community.auth0.com/t/getting-error-with-safari/12795/12 "2018-07-24T14:14:03Z")

</div>

👋 @umeshkolhe.89 I apologize for the delay . Is this the `Not secure` message you are referring to [https://support.apple.com/library/content/dam/edam/applecare/images/en\_US/iOS/ios11-iphone8-safari-unencrypted-website-page-not-secure.jpg](https://support.apple.com/library/content/dam/edam/applecare/images/en_US/iOS/ios11-iphone8-safari-unencrypted-website-page-not-secure.jpg) ? What happens is Safari checks if the website’s certificate is legitimate. When it’s not, Safari displays that `not secure` warning. You want your site to be encrypted so that it masks the data being exchanges, so that only the user and the application can see it. It prevents anyone from “eavesdropping” on you. Earlier you mentioned it seems you have an angular application that uses embedded login (Lock). I am wondering how you have your application setup to have Safari generate that warning.

Is there any reason you are using embedded login over using [universal login](https://auth0.com/docs/hosted-pages/login)?

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [July 26, 2019, 8:38am UTC](https://community.auth0.com/t/getting-error-with-safari/12795/13 "2019-07-26T08:38:09Z")

</div>


