Skip to content

Commit

Permalink
docs: improve react guide (#1532)
Browse files Browse the repository at this point in the history
* docs: add missing project flag

* docs: update guide
  • Loading branch information
aeneasr authored Sep 7, 2023
1 parent 484cde5 commit 4f961e3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
14 changes: 7 additions & 7 deletions code-examples/protect-page-login/react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion code-examples/protect-page-login/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
},
"dependencies": {
"@ory/client": "~1.0.2",
"@ory/client": "~1.2.1",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
Expand Down
4 changes: 2 additions & 2 deletions code-examples/protect-page-login/react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function App() {
const [logoutUrl, setLogoutUrl] = useState<string | undefined>()

// Returns either the email or the username depending on the user's Identity Schema
const getUserName = (identity: Identity) =>
identity.traits.email || identity.traits.username
const getUserName = (identity?: Identity) =>
identity?.traits.email || identity?.traits.username

// highlight-end

Expand Down
8 changes: 8 additions & 0 deletions docs/getting-started/integrate-auth/25_react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,15 @@ happens Ory APIs might not be able to read the cookies sent by your app.
To get your application that runs locally and Ory APIs on the same domain, use Ory Tunnel - a development tool bundled with Ory
CLI. It's like a microservice - an authentication API server on your domain!

First, set up the Ory SDK URL which you can find in the [Ory Console](https://console.ory.sh/projects/current/developers/guides)

```shell-session
export ORY_SDK_URL=https://{project.slug}.projects.oryapis.com
```

and then start the Ory Tunnel:

```
npx @ory/cli tunnel --dev http://localhost:3000
```

Expand Down

0 comments on commit 4f961e3

Please sign in to comment.