<commit_before># OmniAuth Humanapi

This is a [OmniAuth](http://www.omniauth.org/) strategy for authenticating to HumanAPI. To use it, you'll need to sign up for an OAuth2 Application ID and Secret on the [Human API applications page](http://developer.humanapi.co/).

## Basic Usage

    use OmniAuth::Builder do
      provider :humanapi, ENV['HUMANAPI_KEY'], ENV['HUMANAPI_SECRET']
    end

## Example Sinatra usage

    get '/auth/humanapi/callback' do
      auth   = env['omniauth.auth']
      uid    = auth[:uid]
      email  = auth[:info][:email]
      token  = auth[:credentials][:token]
      'ok'
    end<commit_msg>Mention human_id in the readme<commit_after># OmniAuth Humanapi

This is a [OmniAuth](http://www.omniauth.org/) strategy for authenticating to HumanAPI. To use it, you'll need to sign up for an OAuth2 Application ID and Secret on the [Human API applications page](http://developer.humanapi.co/).

## Basic Usage

    use OmniAuth::Builder do
      provider :humanapi, ENV['HUMANAPI_KEY'], ENV['HUMANAPI_SECRET']
    end

## Example Sinatra usage

    get '/auth/humanapi/callback' do
      auth   = env['omniauth.auth']
      uid    = auth[:uid]
      email  = auth[:info][:email]
      token  = auth[:credentials][:token]
      'ok'
    end

## Pre-registration

HumanAPI allows you to [pre-register](https://user.humanapi.co/developer/docs/app_users) users so they won't have to sign up themselves. By pre-registering, you will receive a `humanId` for every user. This has to be passed as a query parameter to the authentication path:

    /auth/humanapi?human_id=52867cbede3155565f000a0d
{'fraction_non_alphanumeric': 0.11152416356877323, 'fraction_numerical': 0.011152416356877323, 'mean_word_length': 3.562146892655367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2419748', 'n_tokens_mistral': 536, 'n_tokens_neox': 505, 'n_words': 160}