Code Monkey home page Code Monkey logo

token-generator's Introduction

token-generator

Allow to generate id_token based on service account.

This tool can help for testing API when gcloud is not installed on a machine, with postman or curl for example. With curl, you can perform this

curl -H "Authorization: Bearer $(curl localhost:8080?aud=https://my-service)" https://my-service/...

It can be used in collocation with an application where getting a token is too complex (old application or out-of-date framework). For this:

  • Run the token-generator server on a free port of the server
  • Run your (old) application
  • Simply perform a GET with an HTTP library on localhost and on the token-generator port for getting the signed id_token.

Download

Already compiled executable are available here

Run the server

Run the token generator with these params:

  • port for changing the port. Optional, default is 8080
  • file for setting the service account json secret file url path. If missing use this one configured in GOOGLE_APPLICATION_CREDENTIALS ev var

Example

 token-generator -port 8081

CAUTION

Never expose this service on a public IP. Your credential can be stolen!

Use the server

Query to the opened port with the audience of the service to reach in the aud query parameter

Example

curl http://localhost:8080?aud=http://my-service

The return is the id_token signed by Google.

License

This library is licensed under Apache 2.0. Full license text is available in LICENSE.

token-generator's People

Contributors

guillaumeblaquiere avatar

Watchers

 avatar

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.