how can i get the user_id from jwt in the localstorage and use it in react?

I am writing a logic to create a post and i want to add the logged in user as the user making the post, i have saved the refresh token in my browser localstorage, when i copy the refresh token and paste in jwt.io, i get this response { "token_type": "refresh", "exp": 1679234275085, "iat": 1674953425085,… Read More how can i get the user_id from jwt in the localstorage and use it in react?

Best practice to get user's idToken from Firebase – using getIdToken(/* forceRefresh */ true) leads to Firebase: Error (auth/quota-exceeded)

I’m working on a dashboard website in react.js where the users can analyze multiple different charts. To get the data for the charts from my node.js server I need to get the user’s ID token to be able to verify it on the server side (return data only if user is authorized). In the firebase… Read More Best practice to get user's idToken from Firebase – using getIdToken(/* forceRefresh */ true) leads to Firebase: Error (auth/quota-exceeded)

Angular does not display JWT protected pictures but it loads them properly?

I’m writing an Angular application (version 14.1) where I fetch images from my backend which are protected by a JSON web token. Meaning, each time the user wants to fetch an image from the backend, a valid JWT needs to be attached onto the request, otherwise you get back a http403 forbidden. From a browser… Read More Angular does not display JWT protected pictures but it loads them properly?

Dynamically change database connection depending on jwt claim

I want to dynamically change my database connection depending on the current client. Every client has a Claim in his JWT with the database string. In my Program.cs I create the database connection with the following line: builder.Services.AddDbContext<My_Context>(x => x.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))); Now I am trying to replace "DefaultConnection" with the individual Claim. Is there a possibility… Read More Dynamically change database connection depending on jwt claim

'NoneType' object has no attribute 'get' Python Flask login function

I’m trying to create a login function using Python Flask to authenticate my APIs but when trying to get the email and password to authenticate these I get the following error: ‘NoneType’ object has no attribute ‘get’ Below is the code for the login function @flask_app.route(‘/login’, methods=[‘POST’]) def login(): email = request.json.get(’email’, None) password =… Read More 'NoneType' object has no attribute 'get' Python Flask login function

Invalid JWT token in a simple C# API

I’ve a simple .Net Core 3.1 Web API example here: public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); services.AddAuthentication(o => {… Read More Invalid JWT token in a simple C# API