Skip to content
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

Using current_user endpoint to fetch the authenticated user #41

Merged
merged 14 commits into from
Oct 9, 2023

Conversation

antkim003
Copy link
Contributor

No description provided.

@antkim003 antkim003 changed the base branch from main to feat/user-endpoint October 5, 2023 23:31
@antkim003 antkim003 changed the base branch from feat/user-endpoint to main October 5, 2023 23:53
@@ -98,7 +96,7 @@ export default function SignIn() {
}

try {
const tokenResponse = await fetch(
await fetch(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May want to make this a constant string somewhere.

@antkim003 antkim003 changed the title DRAFT: Using current_user endpoint to fetch the authenticated user Using current_user endpoint to fetch the authenticated user Oct 9, 2023
@@ -7,13 +7,25 @@ import { Text, View } from '../components/Themed';
export default function TabOneScreen() {
const { user } = useUser();
const { signOut } = useSignOut();
// not sure why but this constantly fires over and over again probably a bug w/ how context was set up
console.log('user', user);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we delete this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

const response = await fetch(
`${process.env['EXPO_PUBLIC_API_URL']}/current-user/`,
{
credentials: 'include',
Copy link
Contributor

@vecchp vecchp Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some more reading it is possible we do not want credentials: 'include'. I believe we want to use the default same origin policy. We can update the backend to support this.

I think we'll need to configure

CORS_ALLOWED_ORIGINS = [
    "https://sub1.example.com",
    "https://sub2.example.com",
]

and

SESSION_COOKIE_DOMAIN = ".example.com"

router.replace('/');
}
}
const userData = await fetchUser();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Davit-BetterAngels Davit-BetterAngels merged commit 44d92fb into main Oct 9, 2023
@Davit-BetterAngels Davit-BetterAngels deleted the feat/user-endpoint-2 branch October 9, 2023 18:40
vecchp pushed a commit that referenced this pull request Jul 1, 2024
* server, betterangels starting commands

* stuck on backend

* initial

* fetch current user

* Added a few things

* adding fetch user

* chagne back to local host

* loop bug fix

* adding fetched user endpoint

* updated session and user fetch

* dev env check

* removed log

---------

Co-authored-by: Davit-BetterAngels <davit@betterangels.la>
Co-authored-by: Davit-BetterAngels <141072810+Davit-BetterAngels@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants