1

I am creating an AuthProvider for an external API using Apex and SOAP API

private void createAuthProvider() {
    createSObject(
        '<urn1:type>AuthProvider</urn1:type>' +
        '<urn1:DeveloperName>' + DEV_NAME + '</urn1:DeveloperName>' +
        '<urn1:FriendlyName>' + DEV_NAME + '</urn1:FriendlyName>' +
        '<urn1:ProviderType>OpenIdConnect</urn1:ProviderType>' +
        '<urn1:OptionsSendAccessTokenInHeader>true</urn1:OptionsSendAccessTokenInHeader>' +
        '<urn1:OptionsSendClientCredentialsInHeader>false</urn1:OptionsSendClientCredentialsInHeader>' +
        '<urn1:DefaultScopes>producer</urn1:DefaultScopes>' +
        '<urn1:ConsumerKey>' + clientId + '</urn1:ConsumerKey>' +
        '<urn1:ConsumerSecret>' + clientSecret + '</urn1:ConsumerSecret>' +
        '<urn1:AuthorizeUrl>' + API_ENDPOINT + '/oauth/authorize</urn1:AuthorizeUrl>' +
        '<urn1:TokenUrl>' + API_ENDPOINT + '/api/v1/oauth/token/</urn1:TokenUrl>'
    );
}

Everything is perfectly created but when I want to do the OAuth Kick using this code I see all URL fields like LinkKickoffUrl are empty.

private PageReference oAuthKickoffUrl() {
    PageReference result = new PageReference(authProvider.LinkKickoffUrl);
    result.getParameters().put('startURL', '/lightning/n/Setup');
    return result;
}

This is not the case when I e.g. create a Twitter Auth Provider directly from the Setup UI.

0

You must log in to answer this question.

Browse other questions tagged .