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

Fix Event not being triggered when a new account is created through OAuth #2421

Conversation

PineappleIOnic
Copy link
Member

What does this PR do?

This PR fixes a bug that event triggers are not being correctly fired when a new account is created with the OAuth endpoints.

Related PRs and Issues

#2406

Have you read the Contributing Guidelines on issues?

Yes, I have.

@TorstenDittmann
Copy link
Contributor

Can you add tests? 🙏🏻

@eldadfux eldadfux added the product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services. label Nov 27, 2021
@eldadfux
Copy link
Member

@PineappleIOnic @TorstenDittmann could you explain what is the core issue? is the API lifecycle cut mid request? why can't we rely on the original trigger. Adding and managing each event per request is not the best design choice if we have other options.

@TorstenDittmann
Copy link
Contributor

@PineappleIOnic @TorstenDittmann could you explain what is the core issue? is the API lifecycle cut mid request? why can't we rely on the original trigger. Adding and managing each event per request is not the best design choice if we have other options.

First of, we can't rely on the original trigger since the events have different payloads. Also triggering resets the Event class, which would require more work as well.

Since we have 2 different payloads, we have to find another way than just relying on the response payload.

That's why I suggested doing this for now and have a discussion around a possible implementation.

@eldadfux
Copy link
Member

eldadfux commented Dec 8, 2021

@TorstenDittmann we do have an option to overwrite the default event data without completely replicating the functionality like implemented here:

if(empty($events->getParam('eventData'))) {
$events->setParam('eventData', $response->getPayload());
}
- why isn't the original event being triggered?

@TorstenDittmann
Copy link
Contributor

@TorstenDittmann we do have an option to overwrite the default event data without completely replicating the functionality like implemented here:

if(empty($events->getParam('eventData'))) {
$events->setParam('eventData', $response->getPayload());
}
- why isn't the original event being triggered?

That was my first suggestion. Then we would still had to clone it, since the event object is reset after the trigger.

Copy link
Member

@eldadfux eldadfux left a comment

Choose a reason for hiding this comment

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

I'm not sure why the lifecycle is stopped after redirect, I feel like this is a patch and I'm not 100% sure what is the root cause for the event to not trigger.

@karniv00l
Copy link
Contributor

Any progress on that? 👀

@PineappleIOnic
Copy link
Member Author

PR is heavily outdated, creating a new one using the new event system...

@PineappleIOnic PineappleIOnic deleted the fix-create-user-OAuth-event branch July 20, 2022 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: accounts.create does not get trigger function on account created with OAuth provider
4 participants