Skip to content

Commit

Permalink
update provider and uid in response header and body to propagate auth…
Browse files Browse the repository at this point in the history
… data
  • Loading branch information
tmjfitch authored and Evan-M committed Feb 13, 2018
1 parent 3e46396 commit c443dbb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def set_user_by_token(mapping=nil)
@token ||= request.headers[access_token_name] || params[access_token_name]
@client_id ||= request.headers[client_name] || params[client_name]

@provider = provider
@provider_id = uid

# client_id isn't required, set to 'default' if absent
@client_id ||= 'default'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ def validate_token
protected

def render_validate_token_success
data = @resource.token_validation_response

uid_name = DeviseTokenAuth.headers_names[:'uid']
provider_name = DeviseTokenAuth.headers_names[:'provider']
data['uid'] = request.headers[uid_name] || params[uid_name]
data['provider'] = request.headers[provider_name] || params[provider_name]
data = resource_data(resource_json: data)

render json: {
success: true,
data: resource_data(resource_json: @resource.token_validation_response)
data: data
}
end

Expand Down

0 comments on commit c443dbb

Please sign in to comment.