Making outbound HTTP (or other RPC) calls from canister code

Is there a way for canister code to make an outbound RPC? Like a REST API request?

Use case: I would like to have an app on the IC to go through an OAuth2 flow as client. This involves so called “back channel” calls, made not from the browser, but rather from the service that implements the 3rd party client.

There are probably many other use cases too.

My understanding is that this could be problematic, as the code would have to be executed by many nodes, and it would result in many HTTP calls instead of one, which is undesirable at the minimum, and may also lead to incorrect behaviour.

Is there any approach?

I think the only way to do something like an outbound request from a canister at the moment is to instead poll the canister and see if anything has changed.

1 Like

ok, so it’s like maintaining a queue of requests within the canister and having off-chain worker nodes poll that queue.

Are there any plans to somehow generalize this pattern and/or provide a supported solution?

Not that I’m aware of, but I think this is going to be a fairly common thing that people want to do and we are just early.

I also think that every challenge presents an opportunity for someone (whether it be an individual, the community, or DFINITY) to do something innovative and impactful.

Thank you. Indeed. I think it is a problem of any side effects that go beyond the state changes of the IC.