View Source LightningWeb.OauthCredentialHelper (Lightning v2.10.4)
A set of helper functions to encodes state and coordinate OAuth callbacks back to a LiveView component.
Summary
Functions
Broadcast a message specifically for forwarding a message to a component.
It expects a subscription_id
, the module of the component and opts
being a keyword list containing an :id
key of the specific component.
Encode and encrypt the callback data which will be sent so a provider
as the state
key in the request.
Subscribe to the oauth_credential
topic.
It expects the a unique ID for the topic, usually the LiveView's socket.id
.
Functions
Broadcast a message specifically for forwarding a message to a component.
It expects a subscription_id
, the module of the component and opts
being a keyword list containing an :id
key of the specific component.
See: Phoenix.LiveView.send_update/3
for more info.
A corresponding LiveView (that is subscribed) is expected to have a matching
handle_info/2
that looks like this:
def handle_info({:forward, mod, opts}, socket) do
send_update(mod, opts)
{:noreply, socket}
end
Encode and encrypt the callback data which will be sent so a provider
as the state
key in the request.
The values are:
subscription_id
The same ID used to subscribe.- The component module The LiveView component that is going to receive update
- The component id The ID of the component
Subscribe to the oauth_credential
topic.
It expects the a unique ID for the topic, usually the LiveView's socket.id
.