How can i hit api using Http Header

i want to fetch data from other server using rest api and i am hitting with http header
.i am passing only one parameter .i had tried many way given below.but i am not succeed.
key -Authorization
Bearer geeaAyOYBkOiuJqZXn2nsL9PwdWy9AH
or
token geeaAyOYBkOiuJqZXn2nsL9wWy9AH
or
user email:password

error
Error: TypeError: Failed to fetch. Does the server allow CORS?status: undefined

maybe try testing the api in post man first and then try to connect it

@Dimos_Vamvourellis i had tried it working fine in postman.but not working here

I had tried same as it.and CORS i have allowed many time.When i am using other api without HTTP HEADER…(without authentication.) it working .but when i am using with auth then it given error me
Screenshot from 2022-04-15 10-01-24

Screenshot from 2022-04-15 10-02-23

Thats strange, Have you added also the parameters (body) in the request?

@Dimos_Vamvourellis no ,i am trying to using GET method.without parameter.
i have added only one parameter in HTTP Header
Authorization:“Bearer YvXqQn7cNlOvkdkXiX0JumQMybb”

But i think you should also add these, otherwise how will you get the right response?

@Dimos_Vamvourellis Sorry what?i did not understand.i have added authorise in header

i mean this one, maybe it has something to do

@Dimos_Vamvourellis thanks for your response.now it is working .it was browser issue.

1 Like