Error de secret id al autenticar con una API

RubenHN 20 Reputation points
2024-09-18T11:22:41.7733333+00:00

Hola,

Os pongo en escenario. Queremos mandar correos desde una web externa, y necesitamos usar una cuenta de correo para ello. El cliente externo usa LIFEARAY.

Nosotros hemos creado una API en Azure Entra ID, hemos puesto los permisos segun Microsoft, pero al mandar el correo desde el cleinte externo no sindica esto:

2024-09-18 11:06:35.254 ERROR [liferay/mail-4][MailOutlookMailAuthTokenProvider:77] Unable to acquire access token

java.util.concurrent.ExecutionException: com.microsoft.aad.msal4j.MsalServiceException: AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret added to app

Además de otras cosas, no se si necesitáis mas datos.

Gracias.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,113 questions
0 comments No comments
{count} votes

Accepted answer
  1. Akhilesh Vallamkonda 9,850 Reputation points Microsoft Vendor
    2024-09-24T07:03:18.2466667+00:00

    Hi @RubenHN

    Thank you for reaching Microsoft Q&A Forum!

    When it comes to your error message - AADSTS7000215: Invalid client secret provided, AADSTS7000215 is an error code that indicates that the client secret provided for authentication is invalid. Can you make sure that you're passing the client_secret using a web app or web API, it shouldn't be used in a native app, because client_secrets can't be reliably stored on devices.

    For more info - Get access and refresh tokens.

    239675-image.png

    If you are still running into same issue, please check the below steps:

    1. If you have added the correct client secret and it is still not working, you can try adding a new client secret to see if you still receive the error. 185377-image.png
    2. Confirm that you are adding the client secret value and not the Secret ID. 185364-image.png
    3. Make sure the URL is encoded properly. If the secret has special characters, they need to be URL encoded. If you don't encode the URL, one workaround is to regenerate a secret that mostly just has upper- and lower-case letters.
    4. Check that the expiration time is set to six, 12, or 18 months, as a few users have reported seeing issues setting the expiration time to 24 months.

    Reference: https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app?tabs=client-secret#add-credentials

    Hope this helps. Do let us know if you any further queries by responding in the comments section..

    Thanks,

    Akhilesh.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. RubenHN 20 Reputation points
    2024-10-08T14:41:24.3266667+00:00

    Hola!!!

    Muchas gracias por vuestra ayuda, finalmente, hablamos con la empresa y configuró unos parámetros en su LIFERAY, nosotros lo hicimos bien.

    Se puede cerrar ya la consulta.

    Gracias.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.