Public
Not applicable

How to hit the stage API without authentication?

Is there a way to use the stage API for an app --- for example, a Vue App, and use fetch('https://community-stage.mysite.com/restapi/v1/messages/id/12345?restapi.response_format=json') without using authentication?

  1. If I am logged into stage, I can put the url in a new tab and I get results there
  2. If I am logged into stage I can put a fetch query in the console and get results but only in the same tab that I'm logged into stage on
  3. We are running SSO 

When I was building the app, I had no problem hitting this URL. But now I get an error response, 

error: {code: 101, message: "No message with the specified uid."}

But the uid exists. 

Unsure if something changed or if there's a secret back door to hit the API or ...? 

I believe I was using a CORS workaround plugin but even that doesn't do it anymore. 

 

Thanks

8 Replies 8
Honored Contributor

@Inactive User ,

You can log support ticket to whitelist the IP from which you want to hit the stage url. Server IP which you share with the support will have the access to hit the API without htaccess

 

.......
Expecting your Kudos and Accepted Solution to my replies.
Not applicable

@Parshant Thanks. So for example, could they do it for "localhost:1234"? 

Honored Contributor

No, it can't be of localhost.

it should be of dedicated server.

.......
Expecting your Kudos and Accepted Solution to my replies.
Khoros Staff

Without authentication, you'll only be able to get public content. So if that message UID is in a private area that would otherwise require authentication, you won't be able to get it from the API without authentication.

-

Professional Services - Sr. Web Engineer

Not applicable

Is stage considered a public area? I am still unable to hit the API and get results despite making it public.

Hi @Inactive User,

 

There's 2 things you could try in this situation:

 

New Commentator

1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway
2. From the APIs navigation pane, choose Stages under an API.
3. From the Stages navigation pane, choose Create.
4. Under Create Stage, enter a stage name, for example, prod, for Stage name.

New Commentator

If you are not using credentials this error appears when you are trying to set the request validator in put and post method, to validate parameters, headers and body. In this case if I’m not wrong it will look for credentials on the header to refuse the request. To summarize, if you are not ready to provide credentials and want to keep them open, don’t enable that option in the request validator. I read on a reddit thread, that this method worked for someone. Unfortunately it was like 2 years ago, so now It is possible to not work. If you are a beginner in IT and want to create website you can use api scrapping with instant setup, to get very vast a part of code you need.

Welcome to the Technology board!

Curious about our platform? Looking to connect on social technology? You've come to the right place!

Are you a Khoros customer? For direct assistance from our Support team, please visit the Support Forum.