I'm trying to post a job at Google Hire. Prerequsites are done as metioned here . I got the service account credentials in a json file.
I tried to get Access Token using :
var jsonFilePath = HttpContext.Current.Server.MapPath("~/GoogleKey/client_secret.json");
var token = GetAccessTokenFromJSONKey(path,"https://www.googleapis.com/auth/indexing"); 
public static async Task<string> GetAccessTokenFromJSONKeyAsync(string jsonKeyFilePath, params string[] scopes)
        {
            using (var stream = new FileStream(jsonKeyFilePath, FileMode.Open, FileAccess.Read))
            {
                return await GoogleCredential
                    .FromStream(stream) // Loads key file  
                    .CreateScoped(scopes) // Gathers scopes requested  
                    .UnderlyingCredential // Gets the credentials  
                    .GetAccessTokenForRequestAsync(); // Gets the Access Token  
            }
        }
 public static string GetAccessTokenFromJSONKey(string jsonKeyFilePath, params string[] scopes)
        {
            return GetAccessTokenFromJSONKeyAsync(jsonKeyFilePath, scopes).Result;
        }
but the problem is after executing the function, it just hangs up/ stops responding. I'm unable to get any value in "token " .
May I know as to where am I doing wrong ???
Thanks in advance.