Skip to content

Commit

Permalink
Merge branch 'master' into fix/iframe-unique-ids
Browse files Browse the repository at this point in the history
  • Loading branch information
luisrudge authored Aug 23, 2019
2 parents 6433b2c + c190d11 commit 00648b4
Show file tree
Hide file tree
Showing 21 changed files with 1,235 additions and 871 deletions.
25 changes: 25 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,28 @@ With this change, an immediate refresh after login works as expected.
Note that even though the workaround doesn't cause any weird side effects in browers, you should ideally remove it after the bug has been fixed in Firefox.

For more context see this [issue](https://github.com/auth0-samples/auth0-react-samples/issues/145).


## Why do I get `auth0_spa_js_1.default is not a function` when using Typescript?

If you're hitting this issue, set `esModuleInterop: true` in your `tsconfig.json` file (inside `compilerOptions`).

Due to how the type system works in Typescript, if one of your dependencies uses `allowSyntheticDefaultImports: true`, then all the consumers of that dependency must use `allowSyntheticDefaultImports: true` as well. This, of course, is not ideal and might break your app if you depend on this setting being `false`. The Typescript team added the `esModuleInterop` flag that helps in this scenario.


## Why do I get `auth0-spa-js must run on a secure origin`?

Internally, the SDK uses [Web Cryptography API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) to create [SHA-256 digest](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest).

According to the spec ([via Github issues](https://github.com/w3c/webcrypto/issues/28)), Web Cryptography API requires a secure origin, so that accessing `Crypto.subtle` in a not secure context return undefined.

In most browsers, secure origins are origins that match at least one of the following (scheme, host, port) patterns:

```
(https, *, *)
(wss, *, *)
(*, localhost, *)
(*, 127/8, *)
(*, ::1/128, *)
(file, *, —)
```
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Auth0 SDK for Single Page Applications using [Authorization Code Grant Flow with

## Table of Contents

Make sure this is updated based on the sections included:

- [Documentation](#documentation)
- [Installation](#installation)
- [Getting Started](#getting-started)
Expand All @@ -21,7 +19,9 @@ Make sure this is updated based on the sections included:

## Documentation

- See the [API reference](https://auth0.github.io/auth0-spa-js/)
- [Documentation](https://auth0.com/docs/libraries/auth0-spa-js)
- [API reference](https://auth0.github.io/auth0-spa-js/)
- [Migrate from Auth0.js to the Auth0 Single Page App SDK](https://auth0.com/docs/libraries/auth0-spa-js/migrate-from-auth0js)

## Installation

Expand All @@ -47,8 +47,7 @@ yarn add @auth0/auth0-spa-js

### Creating the client

> Ideally, you should have only one instance of the client. Create one
> before rendering / initializing your application.
Create an `Auth0Client` instance before rendering or initializing your application. You should only have one instance of the client.

```js
//with async/await
Expand Down
Loading

0 comments on commit 00648b4

Please sign in to comment.