pilcrowOnPaper / arctic

OAuth 2.0 clients for popular providers
MIT License
885 stars 58 forks source link

Salesforce Additional URLs #148

Open jawills opened 3 months ago

jawills commented 3 months ago

For the Salesforce provider, the token and authorize endpoints are hardcoded:

const authorizeEndpoint = "https://login.salesforce.com/services/oauth2/authorize";
const tokenEndpoint = "https://login.salesforce.com/services/oauth2/token";

There is a use case to pass in a dynamic base url, so a feature like providing a custom url, or toggle for the sandbox url is ideal. Ex:

var baseUrl = "https://login.salesforce.com";
if(isSandbox){
    baseUrl = "https://test.salesforce.com";
}
const authorizeEndpoint = baseUrl + "/services/oauth2/authorize";
const tokenEndpoint = baseUrl + "/services/oauth2/token";

Custom domains can also be passed, so it may be best to have an optional parameter in the OAuth2ProviderWithPKCE interface / contstuctor

pilcrowOnPaper commented 3 months ago

We can add this in v2 - can you configure the path as well? i.e. are you limited to /services/oauth2/token or can you do something like /something-else/services/oauth2/token?

jawills commented 3 months ago

I don't believe you can configure the path. I can't see anywhere in the documentation that allows for this. There is the ability to run oauth through JWT.

Adding additional documentation for reference:

pilcrowOnPaper commented 3 months ago

Thanks, will add this in v2!

pilcrowOnPaper commented 2 weeks ago

Added in v2 beta

jawills commented 2 weeks ago

I can test this. Is there an easy way of updating & integrating w/ lucia to test?

pilcrowOnPaper commented 2 weeks ago

Here's the v2 docs

https://arcticjs.dev/guides/migrate-v2