Questions tagged [oauth2]
OAuth 2.0 is the next evolution of the OAuth protocol and is not backwards compatible with OAuth 1.0. OAuth 2.0 focuses on client developer simplicity while providing specific authorization flows for web applications, desktop applications, mobile phones, and living room devices.
863
questions
0
votes
0
answers
15
views
Google Cloud Connection Works with Apex Auth Class but not with Named Credentials
I have hosted an API on google cloud run and the downloaded the service account credentials in below format.
{
"type": "service_account",
"project_id": "...
-1
votes
0
answers
15
views
Calling Quip from Salesforce
I'm trying to call the Quip Admin API from Salesforce. It currently uses the Browser Flow for the authentication type in the external credential, and every once in a while a user has an issue, and ...
3
votes
1
answer
42
views
Getting REST API Token in Salesforce unsupported_grant_type
I want to invoke REST API of Salesforce (they are at: https://mySFDomain.my.salesforce.com/service/data/v57.0/composite - for example).
On an Enterprise Edition org, I can access with request like:
In ...
0
votes
0
answers
40
views
Is Salesforce's refresh token rotation working?
I have enabled the refresh token rotation for my connected app.
My expectation is that when I use my refresh token to acquire a new access token, the current refresh token should expire and a new ...
2
votes
1
answer
457
views
404 URL No Longer Exists with REST API Call
When submitting a GET request with either Postman or boomi, I receive the following 404 error.
‘You have attempted to reach a URL that no longer exists on salesforce.com’
In either tool, I can get the ...
-1
votes
0
answers
29
views
How to connect Salesforce to Microsoft Add in using oauth web server flow? [closed]
Hi I'm developing an add in to create template using word and on click of a button I want to upload the word file to Salesforce
But to achieve this I'm struck at a point how to connect Salesforce to ...
3
votes
2
answers
169
views
Getting the error : Unable to fetch the OAuth token when using an external credential with "Client Credentials with Client Secret Flow"
I am trying to make a webservice call to an authorization server (OAuth 2.0) using the "client_credentials" grant type, but i receive a "System.CalloutException: Unable to fetch the ...
0
votes
1
answer
81
views
Allow calls to most Salesforce APIs from Apex in Unlocked Package
This Apex code from an Unlocked Package
HttpRequest request = new HttpRequest();
request.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId());
request.setHeader('Content-Type', '...
-1
votes
1
answer
79
views
How to create Auth Provider using APEX
I could see AuthProvider Object support Create() and Update(), But when i try to insert its throwing following error.
DML operations are not allowing on Auth. Provider
Code:
AuthProvider authPro = ...
0
votes
0
answers
45
views
Named Credential / External Credential Only Working Once
I've used a Named Credential with External Credential for the Client Credentials with Client Secret Flow.
I didn't find the documentation very helpful to be honest, but this super post helped me get ...
1
vote
2
answers
150
views
Set expiry time of OAuth access token at connected app level
I have seen a lot of stack exchange posts suggesting that the expiry time of the OAuth access token cannot be determined. It is dependent upon the session timeout policy set at user profile level and/...
0
votes
1
answer
41
views
Should an Access Token be renewed for every call using JWT?
Using the OAuth 2.0 JWT Bearer Flow, when does the Access Token need to be renewed?
Let's say the JWT Flow is used to send queries to Salesforce from time to time.
Should one request a new Access ...
3
votes
1
answer
125
views
External/Named Credential - acquiring access token from Mule via client credentials flow
I want to configure Named&External Credentials with oAuth client credentials flow and use it in apex.
An endpoint is exposed by Mulesoft. I followed those very neat instructions shared here, but I ...
0
votes
0
answers
47
views
Programatically give a user access to an ExternalCredential Principal (Per User)
I try to find a way to programatically give a user access to an ExternalCredential Principal (Per User).
The standard way, is to go to personal settings and click "Allow Access".
I found out ...
0
votes
0
answers
65
views
Invalid Auth Header Using Run Flow In Another Org From UnofficialSf
When running the unlocked package Run Flow In Another Org I see a 400 Invalid_Auth_Header error in Debug Logs. Getting a successful response from Postman so I'm guessing something has changed in ...
0
votes
1
answer
290
views
How to get Refresh Token in Postman in 2024?
I've been trying to get the refresh token using Postman without success. It seems from what I've found that some ways have changed over the years. I do have the request to get the access token, which ...
0
votes
1
answer
42
views
Handling Encoded Responses in Salesforce OAuth2 External Credentials
I'm dealing with a specific issue in Salesforce related to External Credentials with OAuth2 protocol. The main problem is that Salesforce doesn't properly accept encoded responses from our ...
-1
votes
1
answer
17
views
Making a web app that allows any salesforce org/user to sign up and see analytics
I'm creating a web application in which a user can "connect" their salesforce account to my web app and see analytics. I've currently looked at creating a connected app, but that only works ...
0
votes
0
answers
46
views
How to escape # in the redirect_uri for OAuth2?
I am redirecting user to salesforce for OAuth. It is giving me the error that unsupported response_type. When i debugged in the detail then i found that it is due to # in the url.
How can i escape #? ...
1
vote
1
answer
104
views
Web flow and access/refresh tokens via php
I'm trying to implement a web flow authentication process using php; so far, I've created the necessary index.php file which is used to get the first code:
// Generate a random code verifier
$...
0
votes
0
answers
69
views
OAUTH_DISALLOWED_SCOPES error when authorizing named credential
I am trying to create a named credential to authorize access to the Salesforce metadata API, as explained in this blog:
https://gscloudsolutions.com/tips-tricks/using-named-credentials-with-the-apex-...
0
votes
0
answers
390
views
External Credentials not making oauth call
I am attempting to implement the Named Credential/External Credential system following this post and am getting "System.CalloutException: Unable to fetch the OAuth token." error. Everything ...
1
vote
0
answers
113
views
External Credential Flow (Existing_link)
Struggeling to Authenticate to Microsoft AD With Open ID Connect using Named Credentials/External Credentials.
First of all: This approach works on all Salesforce Instances, now I have this issue on a ...
0
votes
0
answers
187
views
Named Credential with Basic Authorization Token, Username and Password details
I am trying to callout to an external application APIs to fetch data into Salesforce.
That external application has Auth token URL which will need below details to share Access token (bearer) to be ...
1
vote
1
answer
692
views
Why is OAuth Client Credentials safer than OAuth Username-Password?
According to Salesforce, here
"You can use the username-password flow to authorize a client via a connected app that already has the user’s credentials. However, we recommend avoiding this flow ...
0
votes
0
answers
358
views
PKCE: Invalid Code Verifier
I am trying to implement the PKCE flow into my SPA. I have read a bunch of documentation including the salesforce docs, the RFC for PKCE flow and have watched this step by step instruction from a ...
0
votes
0
answers
99
views
How to specify audience for OAuth token in SF when configuring auth for an Azure protected API endpoint hosting external data?
I have an external data source hosted in Azure which is an OData API endpoint. Everything works well with auth disabled.
I created an application registration in Azure AD to represent the API and ...
0
votes
0
answers
67
views
Named Credential Auth 2.0 JWT Token giving empty error: "Unable to complete the JWT token exchange. Error: . Error description: ."
My JWT token is retrieved using only the following parameters in a json body:
{
"username":"blabla",
"password":"blabla"
}
I don't need the standard JWT ...
0
votes
0
answers
48
views
Newly gained Access Token from social login is resulting in This session is not valid for use with the REST API error for api requests
I am using Django-allauth for social logins. I confirmed that I have the access token that I receive from salesforce after the social login, but when I do
headers = {
"Content-Type": &...
1
vote
1
answer
490
views
Custom login with password for experience cloud sites
We have a few experience cloud sites in production. Right now, the login and register flows are passwordless, using the salesforce's native passwordless login and verification functionalities. Our ...
0
votes
0
answers
292
views
OAuth Client Credentials flow for external services - token expiration
I'm trying to connect to Marketo REST API via an external service leveraged in a flow, using the client credentials external credential and a named credential. Here is Marketo's doc on authentication
...
0
votes
0
answers
105
views
How to use CA Signed certificate in Salesforce Production Org for JWT Authentication in connected app?
We have a requirement to integrate CTI with Salesforce. We want to create a connected app using Digital Certificate.
For the development orgs we used Open SSL (https://www.apexhours.com/salesforce-...
1
vote
0
answers
553
views
Salesforce Named Credentials - oauth token refresh does not work
I am using Named Credentials to make callouts to a sharepoint system.
Initially, callouts from apex code work fine, until the token expires after 12 hrs. Then I am consistently receiving below error:
...
1
vote
0
answers
969
views
Getting error Remote_Error: The remote service returned an error when trying to authenticate named credential using a custom auth
I am trying to authenticate an external service while using a custom authenticator with client credentials, but when I click save I get the error "Remote_Error: The remote service returned an ...
0
votes
1
answer
449
views
cg cloud modeler: user authentication failed
Consumer Goods Cloud Offline App gets an error: User authentication has failed (Code: U1000)
This happens when trying to connect after being asked to log in.
13
votes
1
answer
3k
views
External + Named Credential with oAuth client credentials flow
Given: a REST API that requires authorization. The authorization service attached to the API supports oAuth, one of the available oAuth flows is Client Credentials (grant_type=client_credentials)
How ...
1
vote
1
answer
170
views
External named Credential is not able to fetch in Apex code for Winter 24 Pre
Created the External Named credential with name Samsung Test
Added the Principal
Added the permission set
However I am not able to fetch this named credential in Apex code.
HttpRequest req = new ...
0
votes
0
answers
706
views
Oauth2.0 Authentication code generation from client id and secret in Apex code
I am not able to get the Authorisation code Oauth2.0 from Apex code, However i can get the same from Postman callout. Is it possible to get the authorisation code from apex? I am using the below ...
3
votes
1
answer
162
views
Do scratch orgs have weird behaviors with connected apps? Being given "Invalid_grant" with "user hasn't approved this consumer"
I have created a scratch org and installed a connected app to it. I've set the policy to "Admin Approved users are pre-authorized". I've given the connected app access to a permission set ...
0
votes
0
answers
82
views
OAuth Token Authentication Issue
Named Credentials is setup for "ABC" and same details we are storing in ABC_Metadata__mdt.
Auth. Provider is setup for "ABC" and same details we are storing in ...
2
votes
1
answer
514
views
Callout via Named Credentials with client credentials oAuth flow
I'm trying to set up an external service that will rely on REST API calls from Salesforce to Marketo, which relies on client credentials OAuth 2.0 to authenticate. To authenticate with the Marketo API,...
2
votes
1
answer
363
views
How Do I Use OAuth2.0 With JWT To Connect To Salesforce?
So I'm trying to get a proof-of-concept together so I can ask my employer for access to our Salesforce (I'm a new employee and very low on the food chain, but their current workflow is just STUPID).
I'...
0
votes
1
answer
31
views
Best way for server-to-server auth to Salesforce to be able to then query as specific user
I am trying to authenticate to Salesforce from 3rd party service (custom java app). Users in the 3rd party app should be able to search records in salesforce (query rest api call) and create new ...
0
votes
0
answers
179
views
Problem connecting to the salesforce authentication service when trying to authorize an org
Problem connecting to the salesforce authentication service when trying to authorize an org.
Getting below error:
Could not retrieve the username after successful auth code exchange. Due to: request ...
0
votes
0
answers
195
views
Login Rate Exceeded - external service calls Salesforce using client_credentials
Introduction:
We have an external Java service that communicates with Salesforce instance.
There is a connection using OAuth2.0 client_credentials. For this purpose we have created connected app.
Use ...
0
votes
1
answer
447
views
UserInfo: protecting access token (GET vs POST)
I've noticed when using the official Postman collection, the parameters for any methods have to be put as parameters in the URL, otherwise the status code received is 400.
I've tried debugging it, so ...
0
votes
0
answers
158
views
Get Refresh Token after callout failure
Named Credentials is setup for "ABC" and same details we are storing in ABC_Metadata__c.
We are storing Refresh Token and Access Token in one record custom object Token__c.
We have one ...
0
votes
0
answers
46
views
Authenticating inbound and outbound requests for an external service
I am developing a service that uses a connected app to implement an OAuth flow for Salesforce users. I can store access and refresh tokens and use them to make requests into the orgs of the users who ...
0
votes
0
answers
82
views
How can I run apex code on user login to a digital experience site?
Is it possible to run apex code on a user login to a digital experience site? Without using a loginflow (using Apex Action in Login flow). I do not want a user to see the loginflow interface before ...
0
votes
0
answers
37
views
Access control based on a connected app
I would like to redirect incoming oauth token requests from a certain connected app, to perform additional access control for that specific app before granting it the access token, or at least before ...