Skip to main content

#Authentication Token0 debatiendo

Platique sobre esto en Slack para obtener respuestas más rápido y asistencia en tiempo real.

Hello,

 

I tried to implement Salesforce Auth JWT but am getting unsupported grant type error.

 

JWTBearerTokenExchange Error 400 unsupported grant type

 

Code:

Auth.JWT jwt = new Auth.JWT();

jwt.setSub('user@email.ca');

jwt.setAud('https://custom.sandbox.lightning.force.com');

jwt.setIss('0000000000000000000000000000000000000000000000000');

Auth.JWS jws = new Auth.JWS(jwt, 'certificate');

String token = jws.getCompactSerialization();

System.debug(token);

String tokenEndpoint = 'https://custom.com/services/rest/auth/oauth2/v1/token';

Auth.JWTBearerTokenExchange bearer = new Auth.JWTBearerTokenExchange(tokenEndpoint, jws);

String accessToken = String.valueOf(bearer.getAccessToken());

//String accessToken = String.valueOf(bearer.getHttpResponse());

System.debug(accessToken);

The bearer grant type was defaulted to urn:ietf:params:oauth:grant-type:jwt-bearer. I tried using Named Credentials instead of Apex implementation and am still getting the same error.

 

How do I resolve this issue?

 

Regards,

Shylesh

 

#Apex #Authentication Token #Auth #JWT Bearer Token Exhcange

Hi all,

Since the Winter21 upgrade into our production system on Friday, all of our integration jobs (through our API user) have failed with the error below.  Is anyone else experiencing this problem?  Standard user access is not affected as I can login.  We have raised an urgent case.

 

System.ApplicationException: Failed to get Authentication Token from rest source:https://xxxxxxxxx.my.salesforce.com/services/oauth2/token. Return Code:InternalServerError. Content:

<html><body>

<table cellspacing=10>

<tr><td><span style="font-weight: bold; font-size: 12pt;">Your organization has been disabled</span></td></tr>

<tr><td>

Salesforce.com has disabled access to the system for your company. Please contact Salesforce Customer Support for more information about this error.

<br><br>