How to generate a new API Key for APSR API

There will be a time when a new API Key will need to be generated.

Use a different API Key for each environment the API is deployed on for example for development and Acceptance that API Key might be the same, However for Production we would need to have a new key and guarded as Protected B.

For now the only way to authenticate a call to the API is API Key. In the future that would change.

How to generate a new API Key?

  1. Clone the code for Dev from the following Repo: APSR Repo

  2. Go to the following Page and on line number 53 in ProjectController.cs

    add the following code

//var x = System.Guid.NewGuid();
// Console.WriteLine(x);

you would need to put a breakpoint and run the app locally in order to note the new API Key when it reaches the code.

3. Make sure to note the new GUID number that was displayed since you only have one time, else it will be a new number every time you run this lines.

4. Once you have the new API Key, remove the code from the code and DON’T commit it to the repo.

5. In the App.Config under the value for APSR-ApiKey → Enter the new API Key you generated and save your changes to the App.config file.

6. Run the application and test that the swagger works and you can authenticate an Api call with the new API Key.