Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
mahesh_varma
Product and Topic Expert
Product and Topic Expert
20,451

Note: The steps and processes described here are accurate as of the time of writing, but it's essential to stay updated with any changes on the ANAF portal that may affect this procedure.

In this blog post, I will guide you through the process of generating an authorization token from Postman and ANAF's portal. This authorization token is essential for establishing a connection between SAP Document and Reporting Compliance, cloud edition and ANAF. This will allow you to submit and monitor electronic invoices from eDocument cockpit.

ANAF, which stands for Agenția Națională de Administrare Fiscală (National Agency for Fiscal Administration), enables you to electronically send and receive electronic invoices through their e-Invoicing platform.

Prerequisites:

  1. You should be a registered user on the ANAF portal with a qualified digital certificate, holding one of the SPV PJ rights (legal representative, designated representative, or authorized representative). You can register in the SPV by visiting this link: https://www.anaf.ro/InregPersFizicePublic/#tabs-2.
  2. After completing the registration process on the ANAF portal, you will receive a Client ID and Client Secret, which are required for the subsequent steps.

Now, let's go over the management URLs used for generating the authorization token:

Once you are registered on the ANAF portal, follow these steps to generate an authorization token:

  1. Open Postman application and create a GET operation for the Authorization Endpoint.
  2. Under the Authorization tab, complete the required fields as shown below:
Grant TypeAuthorization Code
Callback URLhttps://oauth.pstmn.io/v1/callback
Auth URLhttps://logincert.anaf.ro/anaf-oauth2/v1/authorize
Access Token URLhttps://logincert.anaf.ro/anaf-oauth2/v1/token
Client ID<Enter the Client ID received during the registration process>
Client Secret<Enter the Client Secret received during the registration process>
Client AuthenticationSend as Basic Auth Header

- Check the 'Authorize using Browser' checkbox.

3. Click the 'Get New Access Token' button.

4. Since you've checked 'Authorize using Browser' in step 2, your browser will automatically open, and you will be prompted to select your certificate for authentication.
Note: Make sure you disable the pop-up blocker in the browser.

5. After a successful authentication, provide your ANAF portal username and password as prompted by the browser and click the 'OK' button.

6. A new token will be generated, and you will see a success message in the browser.

7. You will be automatically redirected back to Postman with a popup displaying the newly generated authorization token. Click the 'Use Token' button.

8. The new token will automatically populate the token field.


Note:
The steps and processes described above guide you through generating an opaque token. However, starting from July 1st, 2024, ANAF mandates the use of JWT tokens. To generate a JWT token, follow all the steps mentioned in this post, and then, before clicking on the 'Get New Access Token' button, make the following adjustments:

  • Go to the Authorization tab in Postman.
  • Under Advanced settings in Auth Request, add the following key-value pair:
    • Key: token_content_type
    • Value: jwt
  • Under Advanced settings in Token Request, add the same key-value pair:
    • Key: token_content_type
    • Value: jwt

jwt_potman.png

This modification ensures that you generate a JWT token as required by ANAF.


To configure the generated token with in the Business Technology Platform(BTP) portal, follow the documentation provided below:

I hope you find this information useful. You can leave a comment on this blog or follow us for more information about SAP Document and Reporting Compliance here in SAP Community.

68 Comments