function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JAGDISH MOREJAGDISH MORE 

I am Doing salesforce to google drive integration. but i am getting error in the google app due to the custom domain in the samesforce.

Apex Classes:-

public class GoogleDriveAuthenticationWithSalesforce {
//This class will authenticate with google and share Acces token to access google.
    private string key = '417326799289-4nfbtudddkb5naivirrber6jv45gi4td.apps.googleusercontent.com';
    private string secret = '4TSvsnB0t_55RVUGX4Y9DPZn';
    private string redirect_uri = 'https://'+System.URL.getSalesforceBaseUrl().getHost()+'/apex/GoogleDriveIntegration'; 
   public GoogleDriveAuthenticationWithSalesforce(){

    }
    
    public PageReference driveAuth(){
        PageReference pg= new PageReference(new AuthUriForApiRequest(key, redirect_uri).authenticationURI);
        return pg;
    } 

}


global class AuthUriForApiRequest {
    global string authenticationURI='';
    public AuthUriForApiRequest(String clientKey, String redirect_Uri){
        string key = EncodingUtil.urlDecode(clientKey, 'UTF-8');
        string uri = EncodingUtil.urlDecode(redirect_Uri, 'UTF-8');
        string authUri = 'https://accounts.google.com/o/oauth2/v2/auth?'+
                         'client_id='+key+//.apps.googleusercontent.com&'+
                         '&response_type=code'+
                         '&scope=openid%20email'+
                         '&redirect_uri='+uri+
                         '&state=security_token%3D138r5719ru3e1%26url%3Dhttps://oauth2-login-demo.example.com/myHome&'+
                         '&login_hint=jsmith@example.com&'+
                         'openid.realm=example.com&'+
                         'nonce=0394852-3190485-2490358&'+
                         'hd=example.com';

        authenticationURI = authUri;
    } 
}

Visualforce page:-
<apex:page Controller="GoogleDriveAuthenticationWithSalesforce">
    <apex:form>
     <apex:pageBlock>
        <apex:commandButton value="Authenticate" action="{!driveAuth}"/>
     </apex:pageBlock>
    </apex:form>
    
</apex:page>

Visualforce Page:-

User-added image

Here I am getting error:-
User-added image



Salesofrce MyDomain:-User-added image


When i tired to regester a my custom domain there also giving error:-
When i copy my custom domain and hit enter showing popup "must be a top level domain"

My problem is why google last shreenshot i am getting eorror must be a top level domain?
i know it is because my custom domain "testmycompany-dev-ed.my.salesforce.com" is a sub domain.
but please some one help me how to resolve this?

I have much eagerness to learn integration help me some one.
JAGDISH MOREJAGDISH MORE
Can any one please help me?