Skip to content

Email Verification and Password Reset support continueUrl#220

Merged
jeromegamez merged 3 commits intobeste:masterfrom
wadewomersley:continue-url-for-auth
Jul 16, 2018
Merged

Email Verification and Password Reset support continueUrl#220
jeromegamez merged 3 commits intobeste:masterfrom
wadewomersley:continue-url-for-auth

Conversation

@wadewomersley
Copy link
Copy Markdown
Contributor

Adds support for continueUrl to reset password and verify email emails that go out as per https://firebase.google.com/docs/auth/custom-email-handler

return $this->request('getOobConfirmationCode', [
'requestType' => 'VERIFY_EMAIL',
'idToken' => $idToken,
'continueUrl' => $continueUrl,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please wrap the array in array_filter(...) to avoid sending an empty continueUrlfield if none is set (the small things :D)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If I do that, am I OK to move the array to a var and add in the URL if not null instead (or use array filter instead of the if check below for future changes? Otherwise I'll have to add the array_filter inside the function and have a custom function so it doesn't remove an ID token of '0' which will look a bit messy?

$data = [
    'requestType' => 'VERIFY_EMAIL',
    'idToken' => $idToken,
];

if ($continueUrl !== null) {
    $data['continueUrl'] = $continueUrl;
}

return $this->request('getOobConfirmationCode', $data);

Copy link
Copy Markdown
Member

@jeromegamez jeromegamez Jul 13, 2018

Choose a reason for hiding this comment

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

Wrapping it with array_filter() really is sufficient - a value of '0' would be rejected by the Firebase REST API anyways.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

'0' is valid for Firebase.
image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's the User UID, not the continue URL ^^

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And that explains my confusion - this function has a token not a UID so by this point it would never be a UID. For some reason I had it in my head this function had the user ID!

return $this->request('getOobConfirmationCode', [
'email' => $email,
'requestType' => 'PASSWORD_RESET',
'continueUrl' => $continueUrl,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please wrap the array in array_filter(...) to avoid sending an empty continueUrlfield if none is set (the small things :D)

@jeromegamez jeromegamez merged commit 2f9dd1b into beste:master Jul 16, 2018
@jeromegamez
Copy link
Copy Markdown
Member

Thanks @wadewomersley! I will update the documentation and create a new release soon.

@jeromegamez
Copy link
Copy Markdown
Member

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.

2 participants