Skip to content

Commit

Permalink
Remove telemetry from authorize URL
Browse files Browse the repository at this point in the history
  • Loading branch information
joshcanhelp committed Mar 27, 2019
1 parent 278aa9f commit 73e4907
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 6 additions & 6 deletions lib/omniauth/strategies/auth0.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'base64'
require 'uri'
require 'omniauth-oauth2'
Expand Down Expand Up @@ -75,16 +77,14 @@ def client
# Define the parameters used for the /authorize endpoint
def authorize_params
params = super
params['auth0Client'] = telemetry_encoded
parse_query = Rack::Utils.parse_query(request.query_string)
params['connection'] = parse_query['connection']
params['prompt'] = parse_query['prompt']
parsed_query = Rack::Utils.parse_query(request.query_string)
params['connection'] = parsed_query['connection']
params['prompt'] = parsed_query['prompt']
params
end

def build_access_token
telemetry_header = { 'Auth0-Client' => telemetry_encoded }
options.token_params.merge!(:headers => telemetry_header)
options.token_params[:headers] = { 'Auth0-Client' => telemetry_encoded }
super
end

Expand Down
6 changes: 4 additions & 2 deletions spec/omniauth/strategies/auth0_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'
require 'jwt'

Expand Down Expand Up @@ -79,7 +81,7 @@
expect(redirect_url).to have_query('state')
expect(redirect_url).to have_query('client_id')
expect(redirect_url).to have_query('redirect_uri')
expect(redirect_url).to have_query('auth0Client')
expect(redirect_url).not_to have_query('auth0Client')
end

it 'redirects to hosted login page' do
Expand All @@ -92,7 +94,7 @@
expect(redirect_url).to have_query('client_id')
expect(redirect_url).to have_query('redirect_uri')
expect(redirect_url).to have_query('connection', 'abcd')
expect(redirect_url).to have_query('auth0Client')
expect(redirect_url).not_to have_query('auth0Client')
end

describe 'callback' do
Expand Down

0 comments on commit 73e4907

Please sign in to comment.