0

How to access a Stitch API from Postman using API Key? The API works with "Anonymous Auth" but not sure how to use with Postman - Server key or User key?

This document https://docs.mongodb.com/stitch/authentication/api-key/#server-api-keys does not specify clearly how to use API Keys.

  1. Created a Atlas > Access Management > API Keys (assuming this is Server API Key)

    enter image description here

  2. Created Stitch > Users (user API Key)

    enter image description here

  3. Created a Stitch API

    enter image description here

Tried this on Postman

enter image description here

Suren Konathala
  • 3,497
  • 5
  • 43
  • 73

2 Answers2

0

With some help from Mongodb support.. here's the solution.

  1. Use the SERVER KEY - Created at Atlas > Access Management > API Keys
  2. Use the KEY: api-key; VALUE: in Postman HEADER.
  3. Do not use Postman's "API KEY" option under Authorization

enter image description here

Suren Konathala
  • 3,497
  • 5
  • 43
  • 73
0

Thank you Suren, this was very halpful. If I may add a clarification: The Atlas App Services (previously "MongoDB Realm, previously "MongoDB Stitch") accept an api-key that is only named precicelly "api-key". At first I called it "Middleware-API-Key", just as I named it upon creation, but no matter the name - the Atlas App Services accept only and precisely "api-key". enter image description here

O.P.
  • 151
  • 5
  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/33097291) – Thomas Smyth - Treliant Nov 08 '22 at 17:24
  • Dear Thomas, thank you for taking the time to reply. I must say I strongly disagree. Indeed my addition doesn't provide a direct answer to the question but as I clearly stated that was not my intention. My purpose was to add a clarification above the fine answer Suren provided, that knowing would have saved me several hours of troubleshooting. So I felt this is the correct place to put it by thinking I might help someone else struggling with a similar issue. Hope this settles this respectful community requirements. Have a wonderful weekend. – O.P. Dec 09 '22 at 13:43