I have an application where I need to check if the user is authorized for some actions in my backend. Is it a good practice to store the app_pub_key in my database once the user is logged in and pass the token_id as an authorization header everytime user makes a request to an api endpoint that requires an authorization? Therefore, I won’t need to pass the app_pub_key as the request body everytime user makes a request.
Calling the getUserInfo() or authenticateUser() functions returns the idToken to frontend. Similarly getPrivateKey() function can be used to retrieve the private key of the user in order to compute app_pub_key. During these computations, the id_token and private_key values are stored inside a variable in my frontend. Is this secure to do so?