Skip to content

Calling API in getInitialProps #9

@MarketBranch

Description

@MarketBranch

First off, awesome example! It really helped me out.

One thing I'm curious about is making API calls from getInitialProps. When I do this, my API routes don't seem to have access to the session at all. However, if I run the API within the React component, it works just fine.

I'm assuming this is because the cookies have no way to get set on the browser given that getInitialProps is being run on the server. Are there any workarounds you know of that might help get the proper cookie and manually set it with the request?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions