Reputation: 669
I'm getting this error when I run the rspec Response body: {"success":false,"errors":["Invalid login credentials"]} here is my code
path '/api/auth/validate_token' do
get 'check token' do
tags 'TokenValidations'
consumes 'application/json'
security [client: {}, uid: {}, access_token: {}]
response '200', 'success' do
let(:headers) { user.create_new_auth_token }
run_test!
end
end
end
Thanks in advance
Upvotes: 3
Views: 1722
Reputation: 97
I think I had the same problem and tried to execute below, then worked for me.
let(:user) { FactoryBot.create(:user, password: 'password') }
let(:tokens) do
post "/api/v1/authority/sign_in",
params: { email: user[:email], password: 'password' },
as: :json
response.headers.slice('client', 'access-token', 'uid')
end
path '/api/v1/messages/' do
get 'Retrieves some messages' do
description 'Get some messages from provided data'
produces 'application/json'
parameter name: 'access-token', in: :header, type: :string
parameter name: 'client', in: :header, type: :string
parameter name: 'uid', in: :header, type: :string
response '200', 'messages found' do
let(:client) { tokens['client'] }
let('access-token') { tokens['access-token'] }
let(:uid) { tokens['uid'] }
schema '$ref' => '#/components/schemas/messages'
run_test!
end
end
end
Upvotes: 2