README

Install

gem 'work_auth_client'

Create and configure a new client:

work_auth_client = new WorkAuthClient::Client
work_auth_client.host = 'https://work-auth-server.com'

Generate an access token for your application:

req = new WorkAuthClient::ClientCredentialsRequest.new(
    client_id: 'your-client-id',
    client_secret: 'your-client-secret',
)

resp = work_auth_client.access_token(req)

if resp.status == 'success'
    access_token = resp.body.access_token
end

Generate an access token for a user:

req = new WorkAuthClient::PasswordRequest.new(
    client_id: 'your-client-id',
    client_secret: 'your-client-secret',
    username: 'andy', 
    password: '123456'
)

resp = work_auth_client.access_token(req)

if resp.status == 'success'
    access_token = resp.body.access_token
end

Verify a token:

</code>