NAF apps that need to access the Public API must perform a code exchange in order to obtain a valid API token. The flow is largely based on OAuth 2.0, but there are some differences, outlined below.
Authentication flow:
- A user clicks a NAF app link in Narmi.
- If applicable, Narmi requests authorization from the user.
- Narmi redirects the browser to the NAF app, with a code included in the URL.
- The NAF app retrieves the code and performs a server-to-server code exchange with the Narmi tokens endpoint (this should never be done inside the browser).
- The NAF app stores the access token. It will use the access token to make authenticated requests to the public API by including it as a bearer token in the
Authorizationheader. Note: the token must always be kept on the server side.