What Info is Available from my APEX Social Sign-In Provider

What Info is Available from my APEX Social Sign-In Provider

Familiar title? Disclaimer, this blog is 100% inspired by Anton Nielsens's amazing blog here

I thought I could jazz up the results a bit in a table format (well slightly more formatted).

How it works: Depending on the scopes you ask for, your Social Sign-In Provider gives you a wad of JSON following authentication. You have one shot at reading the details... in your post_authentication procedure.

In my variant of Anton's work, we have to

  • Create an application item A_SOCIAL_INFO

  • Create a Dynamic Content region on Page 1 with PL/SQL Function Body returning a CLOB of the below code

  • Edit your Social Sign-In authentication scheme

  • Add post_authentication as your Post-Authentication Procedure Name

  • Edit your Social Sign-In authentication scheme and add the following PL/SQL

    procedure post_authentication is
      l_index    varchar2(32767);
      l_kind     number;
      l_value    varchar2(32767);
      l_index := apex_json.g_values.first;

      :A_SOCIAL_INFO :=
        '<table class="t-Report-report">
              <th class="t-Report-colHead">Name</th>
              <th class="t-Report-colHead">Data Type</th>
              <th class="t-Report-colHead align="left">Value</th>

      for i in 1..(apex_json.g_values.count) loop
        l_kind  := apex_json.g_values(l_index).kind;

        if l_kind = 4 then
          l_value := apex_json.g_values(l_index).number_value;
        elsif l_kind = 5 then
          l_value := apex_json.g_values(l_index).varchar2_value;
          l_value := null;
        end if;

        :A_SOCIAL_INFO :=
          :A_SOCIAL_INFO ||
          '<tr>' ||
            '<td class="t-Report-cell" align="left">' || l_index || '</td>' ||
            '<td class="t-Report-cell" align="left">' || CASE l_kind WHEN 4 THEN 'Number' WHEN 5 THEN 'Varchar2' ELSE TO_CHAR(l_kind) END || '</td>' ||
            '<td class="t-Report-cell" align="left">' || l_value || '</td>' ||

        l_index :=  apex_json.g_values.next(l_index);
      end loop;

      :A_SOCIAL_INFO :=
        :A_SOCIAL_INFO ||
        '      </tbody>

      when others then
        :A_SOCIAL_INFO :=
          :A_SOCIAL_INFO || ' err: ' ||sqlerrm;