Using atlassianHostRestClients.authenticatedAsAddon() is throwing 401 errors some times

Using atlassianHostRestClients.authenticatedAsAddon() is throwing 401 errors in some cases
My webhook registration is failing some time as below.Can you please let me know why does this happen so?
The sample snippet as below

		  						.put(String.format(WEBHOOK_REGISTER_URL,cloudURL), request); 

It is happening the same for other rest apis like migration s3 data url download.

   	return atlassianHostRestClients.authenticatedAsAddon().getForEntity(String.format(apiURL, cloudUrl, uriVariable), String.class);

Can you please throw some light on what is causing these 401 errors and how to avoid it?

@AparnaMokkapati please raise the log level of RestTemplate using , as described in this StackOverflow post.

Hello All,
We are facing recently a similar issue and it’s a total blockage for the migration of our customer data from Server to Cloud.
We found out that the APP User (even though it has the scope read, write, delete) is not ADDED AT ALL for the spaces that have been migrated via the CCMA…
So no REST API can be proceeded via the “authenticatedAsAddon”

The user is added if we migrate one or max two spaces but when we migrate an important bench of spaces (more than 10) it’s not added.
Any idea about this ? or could you find a solution for your problem?
Many thanks