Skip to content

Reset Password endpoint #1

@GGPay

Description

@GGPay

Hello there,

Thank you so much for your code and solution, it really useful.
I wonder that you have in folder email_templates reset_password.html but can't find where use it. I see you use providers - google, github.

I'm trying to implement reset_password flow using FastApi and Supabase - but no luck for a month. I'm stuck with getting access_token and refresh_token after user click on a link from email, not able to get them from fragment in url.

endpoint for reset password

@app.get(path="/reset/{token}")
async def change_password(request: Request):

    if request.path_params['token']:
        str_url = "https://fuxdqstuktbkpkgyqytp.supabase.co/auth/v1/verify?redirect_to=http://localhost:8888/change-password&token=" \
                  + request.path_params['token'] + "&type=recovery"

    return RedirectResponse(str_url, status_code=status.HTTP_303_SEE_OTHER)

endpoint for enter new password.


@app.get(path="/change-password")
async def get_change_password(request: Request, response: Response):

    html = f"""
            <html>
                <body>
                    <h1>Forget password</h1>
                    <form action="/update-password" method="post">
                        <label>New password:</label>
                        <input type="New password" name="New password" required />
                        <input type="New re-write" name="New re-write" required />
                        <br />
                        <input type="submit" value="Submit" />
                    </form>
                </body>
            </html>
            """

    return HTMLResponse(html)

I need to get access_token to update password using method - supabase.auth.get_user(jwt)

I would appreciate any help or suggestion.

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