Skip to main content

#Authentication Token토론 중인 항목 0개

더 빠른 답변과 실시간 도움을 받으려면 Slack에서 논의하세요.

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

답변 1개
May Phoon 님이 * Release Readiness Trailblazers *에 글을 올렸습니다

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>