Skip to content

Cannot authenticate with client-initiated flow, fb signed request cookie is not read by ueberauth #41

@yourtallness

Description

@yourtallness

Hello,

While navigating to /auth/facebook works fine, I cannot make a client side flow work properly.
The reason for preferring a client side flow is to authorize FB in a popup so that the user never leaves our site.

I have initialized the FB JS app with the app id and cookie set to true.

    FB.init({
        appId      : appId,
        cookie     : true,
        xfbml      : true,
        version    : 'v2.12'
    });

However in my case the failure callback is getting called on my auth controller because ueberath cannot find the code.

    def callback(%{assigns: %{ueberauth_failure: _fails}} = conn, _params) do
      conn
      |> put_flash(:error, "Failed to authenticate.")
      |> redirect(to: "/")
    end

Line of code in current project

The issue is that ueberauth_facebook does not read the code from the fb signed request cookie in case it cannot find it in the params.

Omniauth extracts the authorization code from the cookie like this:

omniauth code that extracts code either from params or cookie

omniauth cookie parsing logic

The cookie value is Base64 encoded and signed with HMAC-SHA256.

Could this be done here as well to support the client-initiated flow?

Omniauth client side flow documentation

Thanks in advance,

Mark

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions