LightningWeb.OauthCredentialHelper (Lightning v2.14.14)
View SourceA 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_idThe 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
- The current tab (environment name) Which environment/tab is being authorized
Subscribe to the oauth_credential topic.
It expects the a unique ID for the topic, usually the LiveView's socket.id.