-
Notifications
You must be signed in to change notification settings - Fork 404
feat: identities getting started #2103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
TODO:
|
Feedback from @piotrmsc
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Structurally it's going in the right direction, but I think we need a bit more work on the content side!
|
||
```tsx | ||
export default function Page() { | ||
const [session, setSession] = useState<Session | null>(null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am following the guide "step by step" and it does not explain on which port my app should run, which modules beside ory client I should use and the config code example is broken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using latest preview deployment https://docs-gqucrqdpp-ory.vercel.app/docs/identities/get-started/setup#3-configure-the-sdk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am making some assumptions about the reader. If a reader is on this pages, they have a language/framework of choice which means they are familiar with that language/framework. Providing every context will bloat the example snippets. The only context that is required is the ory SDK stuff but language specific context are assumed about the reader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a "What you'll need" section to set some expectation for the reader
Following again blindly "step by step" : When I try logout I am getting 404 after logout call as well, in ory tunnel I see calls and redirects but in the end I end up with 404 from CF blocking rule, do I need to configure something extra? |
const requireAuth = async (req, res, next) => { | ||
try { | ||
const session = await ory.toSession({ cookie: req.header("cookie") }) | ||
req.session = session | ||
next() | ||
} catch (error) { | ||
res.redirect(`${process.env.ORY_SDK_URL}/self-service/login/browser`) | ||
} | ||
} | ||
|
||
app.get("/", requireAuth, (req, res) => { | ||
res.json(req.session.identity.traits) // { email: '[email protected]' } | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be re-used already in sign in /sign up example? you are also partially doing it in /
handler for registration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sign and sign up sections are intentionally flat so the reader can focus on a stripped down version of the code and just care about the core. Then they progress to higher levels of abstraction which is why I created the requireAuth
middleware for protecting routes
To start the account recovery flow, send the user to the recovery page: | ||
|
||
```html | ||
<a href="$ORY_SDK_URL/self-service/recovery/browser">Recover your account</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we have node example shouldn't this be covered also with code example for consistency ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. This should be wrapped in a code example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided to leave this as is since it's straightforward. But happy to reconsider if it hurts the reader's experience
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge PR!
I think we are very close to getting this one perfect and will be a great basis for getting started!
I did not test all the code examples but the ones I tested were straightforward enough - maybe you can create an issue to add automated tests for these examples later on? I think long-term would be good avoid drift.
I also noticed you added some neat new(?) components, love them!
Please track adding a "custom components" section to the README in a followup issue - so others know how to use these components? It is mostly clear from this example, but it could save us some time in the future - you don't need to do it in this PR though.
All in all I had mostly some minor style issues, nothing major. Let me know where you had followup questions, once we have this resolved let's
<TabItem value="console"> | ||
``` | ||
|
||
**Enable and configure account recovery** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Enable and configure account recovery** | |
#### Enable and configure account recovery |
Please "Use bold only when writing about user interface (UI) elements." - see styleguide
Use h4 if you want a section that is "bolded" but does not show up in the TOC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was intentional because it messes up the table of content. Tabs repeat header content when those contents are repeated they are double in the table of content on the side bar
</BrowserWindow> | ||
``` | ||
|
||
**Recovery strategy** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Recovery strategy** | |
#### Recovery strategy |
See above
<TabItem value="cli"> | ||
``` | ||
|
||
**Download your current configuration** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Download your current configuration** | |
#### Download your current configuration |
See above
</BrowserWindow> | ||
``` | ||
|
||
**Adding a social provider** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Adding a social provider** | |
#### Add a social provider |
|
||
Ory offers pre-configured options for popular providers. Check our provider list [here](/docs/kratos/social-signin/overview). | ||
|
||
**Configuring your provider** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Configuring your provider** | |
#### Configure your provider |
</Tabs> | ||
``` | ||
|
||
## Initiating account recovery |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Initiating account recovery | |
## Initiate account recovery |
I agree with the idea of tests,however, to have them running and testing the code examples they would need to be code-complete and currently are not (see my previous review comments on them). Which for me would make sense to have getting-started code examples as code complete with option to collapse lines of code that are not ory-specific. @christiannwamba what's your take on it? |
Co-authored-by: Vincent <[email protected]>
Co-authored-by: Vincent <[email protected]>
Co-authored-by: Vincent <[email protected]>
Co-authored-by: Vincent <[email protected]>
Related Issue or Design Document
Checklist
If this pull request addresses a security vulnerability,
I confirm that I got approval (please contact [email protected]) from the maintainers to push the changes.
Further comments