Bug report
Describe the bug
When using the PKCE flow and generating a link with supabase.auth.admin.generateLink() it doesn't not generate a link that supports the PKCE flow as the code is missing in the url.searchParams when hitting the callback url
It works as expected when using supabase.auth.signInWithPassword() and letting supabase send the e-mail
To Reproduce
Code
const supabase = createClient(PUBLIC_SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY, {
auth: {
autoRefreshToken: false,
persistSession: false,
flowType: 'pkce'
}
})
// Access auth admin api
const adminAuthClient = supabase.auth.admin;
const { data, error } = await supabase.auth.admin.generateLink({
type: 'magiclink',
email: 'email@example.com',
options: {
redirectTo: 'http://127.0.0.1:5173/api/auth/callback'
}
});
console.log(data);
Output in console log
{
"data": {
"properties": {
"action_link": "http://localhost:54321/auth/v1/verify?token=51a3fc23c11754db785d06b52da2c155b46e9556537936cdb67f87c7&type=magiclink&redirect_to=http://127.0.0.1:5173/api/auth/callback",
"email_otp": "793015",
"hashed_token": "51a3fc23c11754db785d06b52da2c155b46e9556537936cdb67f87c7",
"redirect_to": "http://127.0.0.1:5173/api/auth/callback",
"verification_type": "magiclink"
},
"user": {...}
}
}
In the callback route I try to get the code searchParams but it is null.
const code = url.searchParams.get('code');
Expected behavior
When using generateLink with the pkce flow I expect that when the user is redirected to the callback route, the code searchParam is included.
Screenshots
If applicable, add screenshots to help explain your problem.
System information
- OS: [e.g. macOS]
- Browser (if applies) [chrome]
- Version of supabase-js: [2.31.0]
- Version of Node.js: [e.g. 16.20.1]
Additional context
Add any other context about the problem here.
Bug report
Describe the bug
When using the PKCE flow and generating a link with supabase.auth.admin.generateLink() it doesn't not generate a link that supports the PKCE flow as the code is missing in the url.searchParams when hitting the callback url
It works as expected when using supabase.auth.signInWithPassword() and letting supabase send the e-mail
To Reproduce
Code
Output in console log
In the callback route I try to get the code searchParams but it is null.
Expected behavior
When using generateLink with the pkce flow I expect that when the user is redirected to the callback route, the code searchParam is included.
Screenshots
If applicable, add screenshots to help explain your problem.
System information
Additional context
Add any other context about the problem here.