google-auth
google-auth
Google OAuth2 library for crystal
Installation
-
Add the dependency to your
shard.yml
:dependencies: google-auth: github: cyangle/google-auth version: ~> 0.1.1
-
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
- Fork it (https://github.com/cyangle/google-auth/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Chao Yang - creator and maintainer
Repository
google-auth
Owner
Statistic
- 4
- 0
- 0
- 0
- 4
- over 2 years ago
- December 2, 2021
License
MIT License
Links
Synced at
Sun, 22 Dec 2024 05:16:15 GMT
Languages