| 
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 | # File 'app/controllers/stormpath/rails/oauth2/create_controller.rb', line 7
def call
  response.['Cache-Control'] = 'no-store'
  response.['Pragma'] = 'no-cache'
  case grant_type
  when 'client_credentials'
    handle_client_credentials_grant
  when 'password'
    handle_password_grant
  when 'refresh_token'
    handle_refresh_token_grant
  else
    raise UnsupportedGrantType if grant_type.present?
    render json: { error: :invalid_request }, status: 400
  end
rescue UnsupportedGrantType
  render json: { error: :unsupported_grant_type }, status: 400
end |