Setting up a MongoDB Realm Application for JWT authentication/authorization using CosyncJWT is very easy. The Realm API Keys necessary to configure the CosyncJWT service are:
- MongoDB Realm Application Id
- MongoDB Realm Project Id
- Realm project or organization Public API Key
- Realm project or organization Private API key
Retrieving these values is explained in the Realm API Keys section of this documentation.
The developer must first gather all these keys and save them in a file for safe keeping. These keys must be kept secret because they are effectively programmatic passwords to the MongoDB Realm Application. A best practice is to save them to an encrypted file on a removable key fab, and maybe a printout that is kept in a safe.
Enter Keys from MongoDB Realm Tab
Once all the keys have been gathered, configuring a MongoDB Realm Application for the *CosyncJWT Storage module is very easy. First, the developer should go to the MongoDB Realm tab within the application detail, and enter the Realm App Id as shown below.
Next, the developer should press the button Init Cosync JWT and fill in the Realm API keys as shown here:
The initialization should take no more than an about 10 seconds, after the developer hits the Submit button. For proof that the configuration took place, the developer can go to the MongoDB Realm Application portal and verify that the Cosync functions were installed properly. The developer can also go to the Authentication tab within the MongoDB Realm Application portal and select the Custom JWT Authentication (under Authentication Providers) to inspect the configuration - especially the meta-data.