Edge Function - User authentication from Bearer - how to?
Hello,
I am trying to identify the caller of an Edge Function, but I systematically get a "null" value.
Here is what I do:
The <authHeader> corresponds to the <accessToken> from the client side.
The <User> I am getting is always NULL. => I need to get this to validate the requestor.
Could anybody tell me what I am doing wrong?
Thanks in advance,
I am trying to identify the caller of an Edge Function, but I systematically get a "null" value.
Here is what I do:
- On the client side (Flutter), once the user has signed in, I am invoking the function```FunctionResponse? res; final String? accessToken = Supabase.instance.client.auth.session()?.accessToken; try { res = await Supabase.instance.client.functions.invoke( 'ef_authentication_test', body: { "action": "action", "data": { "hello": "worled", }, }, headers: {'Authorization': 'Bearer $accessToken'}, ); TraceHelper.logE('[SupabaseHelper::invokeFunction] -- Response', error: res); } catch (e) { TraceHelper.logE('[SupabaseHelper::invokeFunction] -- Exception', error: e); }```The call invocation works, the <accessToken> exists.
The <authHeader> corresponds to the <accessToken> from the client side.
The <User> I am getting is always NULL. => I need to get this to validate the requestor.
Could anybody tell me what I am doing wrong?
Thanks in advance,