Giter VIP home page Giter VIP logo

google_oauth_2.0's Introduction

Erlang Google OAuth 2.0 API client for Server to Server Applications. This application will get a new access token for every one hour.

#####How to get the RSA Private Key file before running the application

  • Reference https://developers.google.com/identity/protocols/OAuth2ServiceAccount

  • After downloading the privatekey.p12 file enter the following 2 commands to convert in to RSA Private Key

      openssl pkcs12 -in privatekey.p12 -out priv/temp/key-enc.pem -nodes
      openssl rsa -in priv/temp/key-enc.pem -out priv/temp/RSA_Key.pem
    
  • Give the path of this RSA_KEY.pem in the RSA_KEY_PATH Macro in "oauth2_s2s.erl" module.

  • Enter the ISS in the config file and feel free to change other values before running

how to run the application
  • git clone [email protected]:RajuC/Google_OAuth_2.0.git

  • cd Google_OAuth_2.0/

  • make

  • erl -pa ebin/ deps/*/ebin -s oauth2_s2s -config config/sys.config

  • 1> oauth2_s2s:get_access_token().

     [{<<"access_token">>,
     <<"ya29.LwL5_tv6bmaZyqzCm8-LiEA27dUi5UNps5ULvVgOdD-qXvZzxKCvQicModZyqn0r6g">>},
     {<<"token_type">>,<<"Bearer">>},
     {<<"expires_in">>,3600}]
    
  • 2> oauth2_s2s:get_access_token(<<"https://www.googleapis.com/auth/devstorage.full_control">>).

     [{<<"access_token">>,
     <<"ya29.LwJyfO4raybzP5bzDyqIf6lPHjc8rMZeZuxxjGWLy5BMw1L6PzgSvtW54fIg6jbtb">>},
     {<<"token_type">>,<<"Bearer">>},
     {<<"expires_in">>,3600}]
    

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.