---
title: "Authentication with AFAS"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/2078310733/Authentication%20with%20AFAS"
format: markdown
---
> Macro (excerpt)
> 
> Authentication is necessary in order to transfer data with the AFAS platform. In order to authenticate you require an AFAS account including API-permissions.
> 
> Befor the authorization a remote site needs to be made for the specific AFAS environment.
> 
> - Go to Setup and type "Remote Site", Click on Remote Site Settings and create a "New Remote Site".
> - As name fill in: AFAS
> - As Remote Site URL: Fill in <span style="color: #080707">https://{company_id}.rest.afas.online/profitrestservices</span><span style="color: #000000"> for example: If your participant number is: 83535, your Remote Site URL will be: </span><span style="color: #080707">https://85002.rest.afas.online/profitrestservices</span>
> - <span style="color: #000000">Save the Remote Site.</span>
> 
> ### Steps
> 
> > Macro (legacy-content)
> 
> You are now successfully authenticated with AFAS, and should be able to create sync mappings for both inbound and outbound sync.
> 
> 
> If you can not do it – you can issue a token in AFAS  - create new app connector (As written here - [https://help.afas.nl/help/NL/SE/App_Apps_Custom_Tokens_Manual.htm](https://help.afas.nl/help/NL/SE/App_Apps_Custom_Tokens_Manual.htm)), issue a token for a user, copy it and call snippet in apex:
> 
> ```
> FBCONNECT.cls_FBAfterInsertHandler.handleFuture(new Set<Id>{'provider'}, 'token');
> ```
> 
> Provider is a salesforce id as provider
> 
> token is token format <token><version>1</version>....<token>.  
> Use whole section