google-auth

Google OAuth2 library for crystal

google-auth

Google OAuth2 library for crystal

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      google-auth:
        github: cyangle/google-auth
        version: ~> 0.1.1
    
  2. Run shards install

Usage

require "google-auth"

Load credential from json file:

cred = GoogleAuth::FileCredential.new(
  file_path: "/file/path/to/credential/json/file",
  scopes: "https://www.googleapis.com/auth/cloud-platform", # String | Array(String)
  user_agent: "crystal/client",
)

Get access token:

token = cred.get_token

puts token.token_type # => Bearer
puts token.access_token

Development

Install dependencies

shards

Run the tests:

crystal spec

Run lints

./bin/ameba
crystal tool format --check

Contributing

  1. Fork it (https://github.com/cyangle/google-auth/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

google-auth

Owner
Statistic
  • 4
  • 0
  • 0
  • 0
  • 4
  • almost 2 years ago
  • December 2, 2021
License

MIT License

Links
Synced at

Sat, 27 Apr 2024 03:51:53 GMT

Languages