https://github.com/mdwagner/fusionauth-crystal-client
https://github.com/mdwagner/fusionauth-crystal-client
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mdwagner/fusionauth-crystal-client
- Owner: mdwagner
- License: apache-2.0
- Created: 2020-10-15T02:39:37.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-30T02:06:47.000Z (over 4 years ago)
- Last Synced: 2025-01-25T19:30:33.596Z (4 months ago)
- Language: Crystal
- Size: 60.5 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# FusionAuth::FusionAuthClient
This shard is the Crystal client library that helps connect Crystal applications to the FusionAuth (https://fusionauth.io) Identity and User Management platform.
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
fusionauth_client:
github: FusionAuth/fusionauth-crystal-client
```## Usage
Once the shard is installed, you can call FusionAuth APIs like this:
```crystal
require "uuid"
require "fusionauth_client"# Construct the FusionAuth Client
client = FusionAuth::FusionAuthClient.new(
"",
""
)
application_id = ""# Create a user + registration
id = UUID.random.to_s
client.register(id, {
"user" => {
"firstName" => "Crystal",
"lastName" => "Client",
"email" => "[email protected]",
"password" => "password",
},
"registration" => {
"applicationId" => application_id,
"data" => {
"foo" => "bar",
},
"preferredLanguages" => %w(en fr),
"roles" => %w(user),
}
})# Authenticate the user
response = client.login({
"loginId" => "[email protected]",
"password" => "password",
"applicationId" => application_id,
})
user = response.success_response.not_nil!["user"]
```## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/FusionAuth/fusionauth-crystal-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The shard is available as open source under the terms of the [Apache v2.0 License](https://opensource.org/licenses/Apache-2.0).