Blog

  • Basically there are two approaches to acceess data from Google . Both have their own benefits 

     

    1st approach -> Public API access

    Login with your Gmail id . Go to that link Google console . Create a project , and open that project . 

    On left side there is link APIs and auths . 

    Click on Credentials , there is option Public API access create your own key .

    Let suppose you want to get the Distance betwwen two addresses , So for that purpose you can use Google Api .

     

    Ex https://maps.googleapis.com/maps/api/distancematrix/json?origins=delhi&destinations=gurgaon&key=AIzaSyAJ46gsr3-1BcigzrfWib7o92yIXDRRSR4

    So in this purpose you can use Public Key because that data is Publically Available , So whenever you use google API that is publically available then go towards Public API key.

     

     

    2nd Approach -> OAuth

    OAuth means authentication is required to access Google Data . Let suppose you want to Social Authentication (login using Gmail ) , So for this purpose Authentication is required , there are a lot of APIs that google Provide like to access the data of Google Calendar of user etc

    Login with your Gmail id . Go to that link Google console . Create a project , and open that project . 

    On left side there is link APIs and auths . Click on Credentials , there is option Create client ID create your own key .

    So whatever you API need from Google enable that API from google Console.

     

    NOTE -> If you are in testing environment and test on localhost then provide 

    EX  JAVASCRIPT ORIGINS-> http://localhost:8080 (If hit go from gapi client site(javascript))

    REDIRECT URIS -> http://localhost:8080/oauth/callback/googleplus 

     

    **** Be specific in URIS and JAVASCRIPT ORIGINS otherwise it give error origin-mismatch .

    And be specific of using http or https . And if you have your own Domain name then provide that.

     

    Thanks

Tags: