imightbejesus
imightbejesus
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
Okay. Perhaps the Convex docs need to be updated with which token to pass in Authorization header.
32 replies
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
I will need to get back to you with some concrete arguments against this, but from the gut feeling - passing an access token as a part of a body seems like a hack, a wrong one. Also what about GET requests? Where should I put access token in those?
32 replies
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
Access token is for third party services that I don't trust, agree. However I need to call these third party services from convex http action. So I need to pass an access token in Authorization header of the request to my convex http action, in order to be able to use it with whatever is going on inside of the http action.
32 replies
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
This seems wrong. It sounds like your docs encourage to put id token into Authorization header (even though this is not stated explicitly, based on this thread - that's what I understand). (https://docs.convex.dev/auth/functions-auth#http-actions) While Authorization token should contain an access token. Now if I needed to use auth.getUserIdentity() in my http action, I won't be able to do so if I am passing correct token to the Authorization header.
32 replies
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
@ballingt I find the terminology you used a bit confusing. If by Convex Auth you mean - exactly Convex Auth - then this is likely not directly related to my issue, as I do not use Convex Auth. But if you mean auth in Convex in general and specifically via Auth0 - then yes, that is related to my question.
32 replies
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
To be clear, I don't care about getting user identity in an http action, I just need a way to verify that whoever hits the exposed endpoint is authorized to do so.
32 replies
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
32 replies
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
If I send id_token - it works. But the whole point is that I should be sending access token. Which needs to be verified by the backend.
32 replies
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
@Michal Srb that made no difference. Access token is not being validated correctly by the convex. await ctx.auth.getUserIdentity() returns null.
32 replies
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
My guess is that I need to specify audience in authorizationParams when initializing Auth0Provider. Should it be
process.env.REACT_APP_CONVEX_URL?.replace(
/\.cloud$/,
".site"
)
process.env.REACT_APP_CONVEX_URL?.replace(
/\.cloud$/,
".site"
)
? Do I also need to register convex API using the same url on Auth0 side of things?
32 replies
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
Still looking for advice here.
32 replies
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
@Jacob Kim I appreciate you referencing the thread, however I don't think I am experiencing the same issue. I don't use convex auth or nextjs. This is just a react app with Auth0. I've upgraded to convex@1.14.0 and that made no difference. As stated above - I see the token in the headers of my request to the post http endpoint of convex, however await ctx.auth.getUserIdentity() still returns null.
32 replies
CCConvex Community
Created by imightbejesus on 8/11/2024 in #support-community
await ctx.auth.getUserIdentity() returns null in http action
Confirming that access token is indeed passed to the action endpoint.
32 replies