### Using Different Credentials for Basemap and Feature Services in Angular
I'm working on an **Angular** project that integrates ArcGIS and requires different authentication methods for the basemap and feature services:
- The **basemap** uses an **API key** from one ArcGIS account.
- The **feature services** are accessed via **OAuth** authentication from another ArcGIS account.
I've successfully implemented OAuth authentication and can retrieve the feature services. However, when I try to add a feature service to the map, I encounter the following error:
> **GWM_0003: You do not have permission to access this resource**
It appears that setting `esriConfig.apiKey` overrides the OAuth token, leading to an authentication conflict.
### Question:
Is there a way to separate authentication so that:
1. The **basemap** continues to use the API key.
2. The **feature services** use OAuth authentication without conflicts?
Any insights or workarounds would be greatly appreciated!
Hi, instead of setting your apiKey globally (on esriConfig), you can set it directly on the basemap style or basemap layer used, so it will only be applied to requests to those services.
If using one of the basemap styles from the Basemap Style Service, set the API key here: https://developers.arcgis.com/javascript/latest/api-reference/esri-support-BasemapStyle.html#apiKey
Otherwise, you can set the api key on the layer before adding it to the basemap, for example: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-VectorTileLayer.html#apiKe...
If neither of these fit your use case, please let me know more details about the basemap you're bringing in so I can better assist you!