Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

building fails #18

Closed
magiva opened this issue Oct 7, 2019 · 17 comments
Closed

building fails #18

magiva opened this issue Oct 7, 2019 · 17 comments
Assignees

Comments

@magiva
Copy link

magiva commented Oct 7, 2019

if i build this, it says it cannot use the key as its password protected
if i replace the key and build, it says it cannot use newtonsoft.json

@geral2
Copy link
Owner

geral2 commented Oct 7, 2019

Hello there,

I will take a look tonight. So far could you try doing this Issue 9.

@geral2
Copy link
Owner

geral2 commented Oct 9, 2019

Does it worked?

@brad7100
Copy link

brad7100 commented Oct 9, 2019

I have having the same issue. Issue 9 is not working for me.

@geral2 geral2 self-assigned this Oct 9, 2019
@geral2
Copy link
Owner

geral2 commented Oct 9, 2019

So, @brad7100 is your issue related to NewtonSoft.Json or the key meanwhile build the project?.
Could you please upload a print screen?

@brad7100
Copy link

brad7100 commented Oct 9, 2019 via email

@geral2
Copy link
Owner

geral2 commented Oct 9, 2019

Awesome. I will upload a new version removing sign to the assembly. And it will include a Unit Test project.

@brad7100
Copy link

This works great and I am using it for several api's. I am having an issue getting it to work with one api thats using the following syntax 'http://username:[email protected]'. This api works and will get me a response every time outside of sql but when I use it with apicaller, I get '401 Please Authentiate error.' I can even hit ctrl+click on the url in SSMS and get the results to pop up on another tab so I know have the url correct.. What am I doing wrong?

@geral2
Copy link
Owner

geral2 commented Oct 15, 2019

@brad7100 what procedure are you using for this request?. Does this URL require authentication?

@brad7100
Copy link

brad7100 commented Oct 15, 2019 via email

@geral2
Copy link
Owner

geral2 commented Oct 15, 2019

Are you concatenating the username and password to the URL or just sending those values directly in the 'http://username:[email protected]'?

@brad7100
Copy link

brad7100 commented Oct 15, 2019 via email

@geral2
Copy link
Owner

geral2 commented Oct 15, 2019

Could you please try using the one below?

DECLARE @Credentials AS VARCHAR(MAX)
  
  SET @Credentials = CONCAT('Basic ','user:pass')
  
  EXEC [dbo].[APICaller_GETAuth] 
        'http://localhost:5000/api/values'
     ,   @Credentials

@brad7100
Copy link

brad7100 commented Oct 15, 2019 via email

@geral2
Copy link
Owner

geral2 commented Oct 16, 2019

I figured out why it was failing. Just uploaded a new version that included an utility function that would help to make this API call. It was failing due the credectial was being expected as an array of bytes by this API.

You would need to redeploy the CLR and create that new function.

Try the code below and tell me how it goes. It worked for me.

DECLARE @byteArray AS NVARCHAR(MAX)

SELECT @byteArray = [dbo].fn_GetBytes('user:password')

DECLARE @Credentials AS VARCHAR(MAX)
  
SET @Credentials = CONCAT('Basic ',@byteArray)
  
  EXEC [dbo].[APICaller_GETAuth] 
        'https://rest.click2mail.com/molpro/projects'
     ,   @Credentials

@brad7100
Copy link

brad7100 commented Oct 16, 2019 via email

@brad7100
Copy link

Worked great. Thank you again.

@geral2
Copy link
Owner

geral2 commented Oct 16, 2019

You're welcome. Any other issue just let me know.

@geral2 geral2 closed this as completed Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants