N
Novu•9mo ago
Shabinder

401 Unauthorized from Docker API Instance

API endpoints get 401 Unauthorised, not letting me signup. (Docker)
24 Replies
Ask Inkeep
Ask Inkeep•9mo ago
Hi @Shabinder, I'm an AI assistant for Novu. While a team member reviews this question, I'll look through relevant sources and see if I can provide suggestions. Please tag @Ask Inkeep with any follow-up questions. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Marks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed. * Step Conditions * Sign Up on Novu Cloud * API Overview -----------------------------
Ask Inkeep
Ask Inkeep•9mo ago
Answer Receiving a 401 Unauthorized error when trying to interact with API endpoints typically indicates an issue with authentication. For Novu's API, ensuring that you're including the correct API key in the header of your requests is crucial. The API key should be prefixed with 'ApiKey ' in the Authorization field of the header (1) . Here's an example of how to include your API key in a request:
--header 'Authorization: ApiKey <NOVU_API_KEY>'
--header 'Authorization: ApiKey <NOVU_API_KEY>'
Replace <NOVU_API_KEY> with your actual API key, which can be found in the Novu Dashboard's API Key section. If you're using Novu in a Docker environment and facing authentication issues during the signup process, make sure your Docker setup, including environment variables and any necessary configurations, is correctly established. Errors during signup could be related to misconfigurations in your Docker environment rather than with Novu's API itself. Ensure your .env files and Docker configurations are correctly set up for your Novu instance. For detailed instructions on setting up and deploying Novu with Docker, you might want to review the official documentation or community discussions for any similar issues or setup guides (2) (3) (4) . Remember, for Novu's API to work correctly, it should be used in server-side applications to avoid Cross-Origin Resource Sharing (CORS) errors (5) .
Shabinder
ShabinderOP•9mo ago
API Log in above file
Shabinder
ShabinderOP•9mo ago
My .env file below: Secrets YOU MUST CHANGE THESE BEFORE GOING INTO PRODUCTION used as a secret to verify the JWT token signature JWT_SECRET=4a261bc7367ce48f69d1866bb12861cd963f3279208ce820466fb5dd82a5fd66 used to encrypt/decrypt the provider credentials STORE_ENCRYPTION_KEY=e2G#9sLp6q8Zc$4YxU5vA3b@1N*dF!7W Host HOST_NAME=https://novu.shabinder.in General available values 'dev', 'test', 'production', 'ci', 'local' NODE_ENV=local MONGO_MAX_POOL_SIZE=500 MONGO_MIN_POOL_SIZE=100 MONGO USER MONGO_INITDB_ROOT_USERNAME=root MONGO PASSWORD MONGO_INITDB_ROOT_PASSWORD=secret MONGO_URL=mongodb://root:secret@mongodb:27017/novu-db?authSource=admin REDIS_HOST=redis REDIS_PASSWORD= REDIS_CACHE_SERVICE_HOST= AWS S3_LOCAL_STACK=$HOST_NAME:4566 S3_BUCKET_NAME=novu-local S3_REGION=us-east-1 AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test Ports API_PORT=3000 REDIS_PORT=6379 REDIS_CACHE_SERVICE_PORT=6379 WS_PORT=3002 Root URL REACT_APP_WS_URL=$HOST_NAME:3002 Uncomment this one when deploying Novu in the local environment as Web app local Dockerfile will have to load this to be used. Deployment version doesn't need as we inject it with API_ROOT_URL value. REACT_APP_API_URL=http://localhost/ws API_ROOT_URL=$HOST_NAME/api DISABLE_USER_REGISTRATION=false FRONT_BASE_URL=$HOST_NAME:4200 WIDGET_EMBED_PATH=$HOST_NAME/widget/embed.umd.min.js WIDGET_URL=$HOST_NAME/widget Context Paths Only needed for setups with reverse-proxies GLOBAL_CONTEXT_PATH= WEB_CONTEXT_PATH= API_CONTEXT_PATH=api WS_CONTEXT_PATH=ws WIDGET_CONTEXT_PATH=widget Analytics SENTRY_DSN= change these values NEW_RELIC_APP_NAME=Novu
Novu Manage Platform
Novu Manage Platform
Pawan Jain
Pawan Jain•8mo ago
@Shabinder Could you share the error screenshot?
Shabinder
ShabinderOP•8mo ago
@Pawan Jain
No description
No description
No description
Shabinder
ShabinderOP•8mo ago
API Log from Docker
Tomer Barnea
Tomer Barnea•8mo ago
ping @Pawan Jain
Pawan Jain
Pawan Jain•8mo ago
@Shabinder Did you login after registration?
Shabinder
ShabinderOP•8mo ago
It doesnt allow me to login, always 401. Have tried, sign flow and login flow both, all calls 401 except the first create call in signup flow. as you can see the sequence of calls and their responses in above screenshots.
Pawan Jain
Pawan Jain•8mo ago
@Shabinder Strangely, I don't see /login request in network tab Could you try login in private window?
Shabinder
ShabinderOP•8mo ago
@Pawan Jain
No description
No description
Novu_Bot
Novu_Bot•8mo ago
@Shabinder, you just advanced to level 1!
Pawan Jain
Pawan Jain•8mo ago
@Shabinder Thanks for sharing. Its a bit strange behaviour. Can you check if api base url for /me request is same as with /login
Shabinder
ShabinderOP•8mo ago
@Pawan Jain
No description
No description
No description
Pawan Jain
Pawan Jain•8mo ago
Hi @Shabinder thanks I will take a look at this Can I signup on this domain if you don't mind 🙂
Shabinder
ShabinderOP•8mo ago
Yes lemme boot it up again for you to test.
Pawan Jain
Pawan Jain•8mo ago
I will be able to check in few hours as I am AFK
Shabinder
ShabinderOP•8mo ago
No worries, its live, also I am happy to have a live session if that would help you better diagnose it @Pawan Jain any luck ?
Pawan Jain
Pawan Jain•8mo ago
I tried to signup facing the same issue
Shabinder
ShabinderOP•8mo ago
Any thesis on why this might be happening ? and what would be our next steps in resolving this ?
Pawan Jain
Pawan Jain•8mo ago
Will you be open for screen sharing session sometime tomorrow or next week?
Shabinder
ShabinderOP•8mo ago
Yes, sure, lemme know what time would be feasible, can do today if feasible...
Pawan Jain
Pawan Jain•8mo ago
messaged you
Want results from more Discord servers?
Add your server