<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jonatan Männchen</title>
    <description>The latest articles on DEV Community by Jonatan Männchen (@maennchen).</description>
    <link>https://dev.to/maennchen</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1332769%2F76a54412-f71a-4ec4-b52c-b629575ae42f.jpeg</url>
      <title>DEV Community: Jonatan Männchen</title>
      <link>https://dev.to/maennchen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maennchen"/>
    <language>en</language>
    <item>
      <title>Navigating the EEF Stipend Process</title>
      <dc:creator>Jonatan Männchen</dc:creator>
      <pubDate>Wed, 09 Oct 2024 09:08:52 +0000</pubDate>
      <link>https://dev.to/maennchen/navigating-the-eef-stipend-process-3e1c</link>
      <guid>https://dev.to/maennchen/navigating-the-eef-stipend-process-3e1c</guid>
      <description>&lt;h1&gt;
  
  
  Unlock the Power of OpenID Connect on the BEAM
&lt;/h1&gt;

&lt;p&gt;In today's digital world, implementing secure and efficient authentication systems is more critical than ever. OpenID Connect has emerged as a powerful protocol, offering seamless and secure login experiences for applications. I recently delved deep into this topic during my talk at Code BEAM San Francisco, titled &lt;strong&gt;"Unlock the Power of OpenID Connect on the BEAM."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For those who couldn't attend, I'm excited to share the key insights and developments from that presentation through this series of blog posts. If you're interested in exploring further, you can watch the &lt;a href="https://www.youtube.com/watch?v=4mTrqRSttyo" rel="noopener noreferrer"&gt;talk recording&lt;/a&gt; and download the &lt;a href="https://drive.google.com/file/d/1QoFH6OVZU02aQA8Z5fDM4459K34SBXGv/view?usp=sharing" rel="noopener noreferrer"&gt;slides&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/4mTrqRSttyo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Whether you're new to OpenID Connect or looking to enhance your application's security, these posts aim to provide valuable insights and practical guidance.&lt;/p&gt;




&lt;h3&gt;
  
  
  Part 3: Navigating the EEF Stipend Process
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Background and Motivation
&lt;/h4&gt;

&lt;p&gt;Balancing the redevelopment of &lt;code&gt;oidcc&lt;/code&gt; with professional responsibilities was challenging. Recognizing the importance of this work, I approached the &lt;a href="https://erlef.org/" rel="noopener noreferrer"&gt;Erlang Ecosystem Foundation (EEF)&lt;/a&gt; through their Security Working Group, seeking a stipend to dedicate time to the project.&lt;/p&gt;

&lt;p&gt;Initially, I faced some timing challenges, but when I transitioned to a role at &lt;a href="https://sustema.io/" rel="noopener noreferrer"&gt;Sustema&lt;/a&gt;, an insurtech startup, I found myself with a one-month gap before starting my new position. Seizing this opportunity, I reapplied for the stipend and was approved.&lt;/p&gt;

&lt;h4&gt;
  
  
  A Positive Experience with the EEF
&lt;/h4&gt;

&lt;p&gt;Implementing a stipend with the EEF was a great experience. The process was straightforward, and the collaboration with the foundation was very good and uncomplicated. Their support allowed me to focus intensively on redeveloping the &lt;a href="https://hex.pm/packages/oidcc" rel="noopener noreferrer"&gt;&lt;code&gt;oidcc&lt;/code&gt;&lt;/a&gt; library.&lt;/p&gt;

&lt;p&gt;The result was a robust, fully certified client library that met the requirements of the OpenID Connect Core specification and implemented many of its optional features, particularly those enhancing security. We incorporated advanced security measures, making it suitable for high-security environments where trust and compliance are paramount.&lt;/p&gt;

&lt;p&gt;To share these developments with the broader community, I introduced the updated library alongside Lars on &lt;a href="https://www.beamrad.io/63" rel="noopener noreferrer"&gt;Beam Radio&lt;/a&gt;. As part of my commitment to the EEF and to promote secure authentication practices, I also presented a talk at &lt;a href="https://codebeamamerica.com/talks/unlock-the-power-of-openid-connect-on-the-beam/" rel="noopener noreferrer"&gt;Code BEAM San Francisco&lt;/a&gt;. The talk aimed to raise awareness about the importance of secure OpenID Connect implementations and showcase how the &lt;code&gt;oidcc&lt;/code&gt; library can facilitate this on the BEAM platform.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Stipend Process at the EEF
&lt;/h4&gt;

&lt;p&gt;The Erlang Ecosystem Foundation offers stipends to support projects that benefit the BEAM community. The goal is to fund open-source development, trainings, workshops, and other initiatives that help increase and expand the BEAM community, especially among those new to Erlang, Elixir, and the ecosystem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Aspects of the Stipend Program:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Focus on Community Growth:&lt;/strong&gt; The foundation favors stipends targeted toward beneficiaries new to the BEAM ecosystem, aiming to broaden the community.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preferred Initiatives:&lt;/strong&gt; Supports online workshops, training materials, hands-on trainings, open-source development work, and diversity efforts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Application Process:&lt;/strong&gt; The process is straightforward. Proposals should be concise with clear objectives. Applicants are encouraged to seek additional sponsorship from corporations or local sponsors to foster sustainable, long-term relationships.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Learn more: &lt;a href="https://erlef.org/stipends" rel="noopener noreferrer"&gt;https://erlef.org/stipends&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  Looking Ahead
&lt;/h4&gt;

&lt;p&gt;As I continue to contribute to the BEAM ecosystem and develop tools like &lt;code&gt;oidcc&lt;/code&gt;, I'm excited about new opportunities on the horizon. Starting in November, I'm open to taking on a new role within the community. If you're seeking someone with a passion for building secure, scalable applications and advancing the state of the art in Erlang and Elixir, I'd love to hear from you.&lt;/p&gt;

</description>
      <category>techtalks</category>
      <category>elixir</category>
      <category>erlang</category>
      <category>openid</category>
    </item>
    <item>
      <title>Implementing OpenID Connect on the BEAM</title>
      <dc:creator>Jonatan Männchen</dc:creator>
      <pubDate>Wed, 09 Oct 2024 09:08:14 +0000</pubDate>
      <link>https://dev.to/maennchen/implementing-openid-connect-on-the-beam-30e4</link>
      <guid>https://dev.to/maennchen/implementing-openid-connect-on-the-beam-30e4</guid>
      <description>&lt;h1&gt;
  
  
  Unlock the Power of OpenID Connect on the BEAM
&lt;/h1&gt;

&lt;p&gt;In today's digital world, implementing secure and efficient authentication systems is more critical than ever. OpenID Connect has emerged as a powerful protocol, offering seamless and secure login experiences for applications. I recently delved deep into this topic during my talk at Code BEAM San Francisco, titled &lt;strong&gt;"Unlock the Power of OpenID Connect on the BEAM."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For those who couldn't attend, I'm excited to share the key insights and developments from that presentation through this series of blog posts. If you're interested in exploring further, you can watch the &lt;a href="https://www.youtube.com/watch?v=4mTrqRSttyo" rel="noopener noreferrer"&gt;talk recording&lt;/a&gt; and download the &lt;a href="https://drive.google.com/file/d/1QoFH6OVZU02aQA8Z5fDM4459K34SBXGv/view?usp=sharing" rel="noopener noreferrer"&gt;slides&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/4mTrqRSttyo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Whether you're new to OpenID Connect or looking to enhance your application's security, these posts aim to provide valuable insights and practical guidance.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 2: Implementing OpenID Connect on the BEAM
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Background and Motivation
&lt;/h3&gt;

&lt;p&gt;Despite OpenID Connect's critical role in modern authentication, I found myself increasingly frustrated with the existing client implementations available for the BEAM ecosystem. Many libraries lacked comprehensive support for the full OpenID Connect specification, especially concerning advanced security features and compliance requirements. This gap not only complicated our development process but also raised concerns about the security and reliability of the applications we were building for our clients.&lt;/p&gt;

&lt;p&gt;Determined to address these shortcomings, I took over the maintenance of the &lt;a href="https://hex.pm/packages/oidcc" rel="noopener noreferrer"&gt;&lt;code&gt;oidcc&lt;/code&gt;&lt;/a&gt; library, originally developed by Indigo. The library already existed but did not fulfill the requirements I had set. I took over the project and implemented a completely new version to fully comply with the OpenID Connect Core specification and include optional security features crucial for high-stakes applications like banking and healthcare.&lt;/p&gt;

&lt;h3&gt;
  
  
  Implementing OpenID Connect on the BEAM
&lt;/h3&gt;

&lt;p&gt;With the understanding of OpenID Connect's fundamentals and its security features, the next step is integrating it into applications built on the BEAM—the Erlang virtual machine that powers languages like Erlang and Elixir. Implementing OpenID Connect on the BEAM allows developers to leverage the concurrency and fault tolerance of the platform while providing secure authentication mechanisms in their applications.&lt;/p&gt;

&lt;h4&gt;
  
  
  Challenges with Existing Libraries:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Incomplete Implementations:&lt;/strong&gt; Existing libraries often lacked full support for the OpenID Connect specification, implementing only basic features necessary for simple authentication flows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Missing Security Features:&lt;/strong&gt; Optional but crucial security features were frequently absent, which are essential for applications handling sensitive data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lack of Compliance and Certification:&lt;/strong&gt; Without full compliance and certification, there was a lack of trust and assurance in the reliability and security of these libraries.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Introducing &lt;code&gt;oidcc&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;To address the need for a comprehensive and secure solution, I developed a completely new version of &lt;a href="https://hex.pm/packages/oidcc" rel="noopener noreferrer"&gt;&lt;code&gt;oidcc&lt;/code&gt;&lt;/a&gt;, a fully compliant OpenID Connect client library designed specifically for Erlang and Elixir applications running on the BEAM.&lt;/p&gt;

&lt;h4&gt;
  
  
  What Is &lt;code&gt;oidcc&lt;/code&gt;?
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;oidcc&lt;/code&gt; is an OpenID Connect client library that aims to provide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Complete Support for OpenID Connect Core Specification:&lt;/strong&gt; Implements all mandatory features and many optional ones outlined in the OpenID Connect standard, ensuring broad compatibility with identity providers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advanced Security Features:&lt;/strong&gt; Includes support for optional security mechanisms such as PKCE, various client authentication methods, token validation, and more.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compliance and Certification:&lt;/strong&gt; Designed to meet the compliance requirements set by the OpenID Foundation, providing confidence in its reliability and security.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ease of Use:&lt;/strong&gt; Focuses on simplicity and developer-friendliness, making it straightforward to integrate into existing applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Erlang and Elixir Support:&lt;/strong&gt; Compatible with both Erlang and Elixir, offering flexibility for developers working in either language.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Key Features of &lt;code&gt;oidcc&lt;/code&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Full OpenID Connect Core Implementation:&lt;/strong&gt; Supports all standard authentication flows, including the Authorization Code Flow, Implicit Flow, Hybrid Flow, and more.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security by Default:&lt;/strong&gt; Enforces best security practices out of the box, reducing the risk of misconfiguration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Provider Configuration:&lt;/strong&gt; Utilizes the OpenID Connect discovery mechanism to dynamically retrieve provider configurations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token Management:&lt;/strong&gt; Provides robust token handling, including validation, refreshing, and revocation support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pluggable Architecture:&lt;/strong&gt; Designed to be extensible, allowing developers to customize and extend functionality as needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive Documentation and Examples:&lt;/strong&gt; Accompanied by detailed documentation and practical examples.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Companion Libraries
&lt;/h4&gt;

&lt;p&gt;To facilitate seamless integration with popular web frameworks and tools in the BEAM ecosystem, &lt;code&gt;oidcc&lt;/code&gt; includes several companion libraries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://hex.pm/packages/oidcc_cowboy" rel="noopener noreferrer"&gt;&lt;code&gt;oidcc_cowboy&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Integration with Cowboy, a small, fast, and modern HTTP server for Erlang/OTP.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://hex.pm/packages/oidcc_plug" rel="noopener noreferrer"&gt;&lt;code&gt;oidcc_plug&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Support for Plug, allowing easy integration with Phoenix.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://hex.pm/packages/phx_gen_oidcc" rel="noopener noreferrer"&gt;&lt;code&gt;phx_gen_oidcc&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; A Phoenix generator that helps set up OpenID Connect authentication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://hex.pm/packages/ueberauth_oidcc" rel="noopener noreferrer"&gt;&lt;code&gt;ueberauth_oidcc&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Integration with Überauth, enabling developers to add OpenID Connect strategies to their authentication pipeline.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Why Choose &lt;code&gt;oidcc&lt;/code&gt;?
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Security and Compliance:&lt;/strong&gt; Adheres strictly to the OpenID Connect specifications and incorporates advanced security features.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community and Support:&lt;/strong&gt; Hosted under the Erlang Ecosystem Foundation's GitHub organization, benefiting from community contributions and oversight.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility:&lt;/strong&gt; Offers the flexibility to meet requirements for both simple and complex applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ease of Integration:&lt;/strong&gt; Companion libraries and comprehensive documentation simplify integration.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Installation and Setup
&lt;/h3&gt;

&lt;p&gt;Integrating &lt;code&gt;oidcc&lt;/code&gt; into your BEAM applications is straightforward, whether you're using Elixir or Erlang.&lt;/p&gt;

&lt;h4&gt;
  
  
  Installing &lt;code&gt;oidcc&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;Add &lt;code&gt;oidcc&lt;/code&gt; and its companion libraries to your project's dependencies.&lt;/p&gt;

&lt;h5&gt;
  
  
  For Elixir Projects (&lt;code&gt;mix.exs&lt;/code&gt;):
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="k"&gt;defmodule&lt;/span&gt; &lt;span class="no"&gt;MyApp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;MixProject&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="no"&gt;Mix&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;Project&lt;/span&gt;

  &lt;span class="c1"&gt;# ...&lt;/span&gt;

  &lt;span class="k"&gt;defp&lt;/span&gt; &lt;span class="n"&gt;deps&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:oidcc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"~&amp;gt; 3.1"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;           &lt;span class="c1"&gt;# Core library&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:oidcc_plug&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"~&amp;gt; 0.1.1"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;    &lt;span class="c1"&gt;# Plug/Phoenix integration&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:ueberauth_oidcc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"~&amp;gt; 0.3.1"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;# Überauth integration (optional)&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run &lt;code&gt;mix deps.get&lt;/code&gt; to fetch the dependencies.&lt;/p&gt;

&lt;h5&gt;
  
  
  For Erlang Projects (&lt;code&gt;rebar.config&lt;/code&gt;):
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight erlang"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;deps&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;oidcc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"~&amp;gt; 3.1"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;             &lt;span class="c"&gt;% Core library
&lt;/span&gt;    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;oidcc_cowboy&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"~&amp;gt; 3.0"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;       &lt;span class="c"&gt;% Cowboy integration
&lt;/span&gt;&lt;span class="p"&gt;]}.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run &lt;code&gt;rebar3 get-deps&lt;/code&gt; to fetch the dependencies.&lt;/p&gt;

&lt;h4&gt;
  
  
  Configuring Provider Introspection
&lt;/h4&gt;

&lt;p&gt;Start a provider configuration worker to communicate with your OpenID Connect provider.&lt;/p&gt;

&lt;h5&gt;
  
  
  Elixir Example:
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:ok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_pid&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="no"&gt;Oidcc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ProviderConfiguration&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;Worker&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;start_link&lt;/span&gt;&lt;span class="p"&gt;(%{&lt;/span&gt;
    &lt;span class="ss"&gt;issuer:&lt;/span&gt; &lt;span class="s2"&gt;"https://example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;name:&lt;/span&gt; &lt;span class="no"&gt;MyApp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;OidcProvider&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Erlang Example:
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight erlang"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;_&lt;/span&gt;&lt;span class="nv"&gt;Pid&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="nn"&gt;oidcc_provider_configuration_worker&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;start_link&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;issuer&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"https://example.com"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;local&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;myapp_oidc_provider&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Implementing Authentication
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Elixir Example:
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Define the callback URI&lt;/span&gt;
&lt;span class="n"&gt;callback_uri&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https://example.com/auth/callback"&lt;/span&gt;

&lt;span class="c1"&gt;# Create the redirect URI&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:ok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;redirect_uri&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="no"&gt;Oidcc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;create_redirect_url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="no"&gt;MyApp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;OidcProvider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_secret&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;%{&lt;/span&gt;&lt;span class="ss"&gt;redirect_uri:&lt;/span&gt; &lt;span class="n"&gt;callback_uri&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Redirect the user to `redirect_uri`&lt;/span&gt;

&lt;span class="c1"&gt;# After authentication, exchange the authorization code for tokens&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:ok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="no"&gt;Oidcc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;retrieve_token&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;auth_code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="no"&gt;MyApp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;OidcProvider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_secret&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;%{&lt;/span&gt;&lt;span class="ss"&gt;redirect_uri:&lt;/span&gt; &lt;span class="n"&gt;callback_uri&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Integrating with Web Frameworks
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Using Cowboy (Erlang):
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight erlang"&gt;&lt;code&gt;&lt;span class="c"&gt;% Setup options
&lt;/span&gt;&lt;span class="nv"&gt;OidccCowboyOpts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;myapp_oidc_provider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_id&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"your_client_id"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_secret&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"your_client_secret"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;redirect_uri&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"http://example.com/auth/callback"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;

&lt;span class="c"&gt;% Success handler
&lt;/span&gt;&lt;span class="nv"&gt;OidccCowboyCallbackOpts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="nn"&gt;maps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;merge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;OidccCowboyOpts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;handle_success&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;Req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;_&lt;/span&gt;&lt;span class="nv"&gt;Token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"sub"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;Subject&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
            &lt;span class="nn"&gt;cowboy_req&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;reply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"Hello "&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;Subject&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s"&gt;"!"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nv"&gt;Req&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="p"&gt;}),&lt;/span&gt;

&lt;span class="c"&gt;% Register routes
&lt;/span&gt;&lt;span class="nv"&gt;Dispatch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;cowboy_router&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;'_'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"/auth/init"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;oidcc_cowboy_authorize&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;OidccCowboyOpts&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"/auth/callback"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;oidcc_cowboy_callback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;OidccCowboyCallbackOpts&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]}&lt;/span&gt;
&lt;span class="p"&gt;]),&lt;/span&gt;

&lt;span class="c"&gt;% Start the server
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;_}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;cowboy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;start_clear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8080&lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;env&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;dispatch&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Dispatch&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Using Plug/Phoenix (Elixir):
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="k"&gt;defmodule&lt;/span&gt; &lt;span class="no"&gt;MyAppWeb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;OidcController&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="no"&gt;MyAppWeb&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:controller&lt;/span&gt;
  &lt;span class="n"&gt;alias&lt;/span&gt; &lt;span class="no"&gt;Oidcc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;Plug&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="no"&gt;Authorize&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;AuthorizationCallback&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="n"&gt;plug&lt;/span&gt; &lt;span class="no"&gt;Authorize&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="p"&gt;[&lt;/span&gt;
         &lt;span class="ss"&gt;provider:&lt;/span&gt; &lt;span class="no"&gt;MyApp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;OidcProvider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="ss"&gt;client_id:&lt;/span&gt; &lt;span class="s2"&gt;"your_client_id"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="ss"&gt;client_secret:&lt;/span&gt; &lt;span class="s2"&gt;"your_client_secret"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="ss"&gt;redirect_uri:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="bp"&gt;__MODULE__&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;callback_uri&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
       &lt;span class="p"&gt;]&lt;/span&gt;
       &lt;span class="ow"&gt;when&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:authorize&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="n"&gt;plug&lt;/span&gt; &lt;span class="no"&gt;AuthorizationCallback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="p"&gt;[&lt;/span&gt;
         &lt;span class="ss"&gt;provider:&lt;/span&gt; &lt;span class="no"&gt;MyApp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;OidcProvider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="ss"&gt;client_id:&lt;/span&gt; &lt;span class="s2"&gt;"your_client_id"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="ss"&gt;client_secret:&lt;/span&gt; &lt;span class="s2"&gt;"your_client_secret"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="ss"&gt;redirect_uri:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="bp"&gt;__MODULE__&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;callback_uri&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
       &lt;span class="p"&gt;]&lt;/span&gt;
       &lt;span class="ow"&gt;when&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:callback&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;callback_uri&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sx"&gt;~p"/oidc/callback"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;authorize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_params&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="n"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;%&lt;/span&gt;&lt;span class="no"&gt;Plug&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;Conn&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="ss"&gt;private:&lt;/span&gt; &lt;span class="p"&gt;%{&lt;/span&gt;&lt;span class="no"&gt;AuthorizationCallback&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;_params&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:ok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;_token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userinfo&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class="n"&gt;conn&lt;/span&gt;
        &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;put_session&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"oidc_claims"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userinfo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;to:&lt;/span&gt; &lt;span class="s2"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:error&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class="n"&gt;conn&lt;/span&gt;
        &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;put_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;|&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:error&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;reason:&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Retrieving User Information and Introspection
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Elixir Example:
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Retrieve user information&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:ok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;claims&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="no"&gt;Oidcc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;retrieve_userinfo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="no"&gt;MyApp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;OidcProvider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_secret&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;%{}&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Introspect the access token&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:ok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;introspection&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="no"&gt;Oidcc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;introspect_token&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="no"&gt;MyApp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;OidcProvider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_secret&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Refreshing Tokens
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Elixir Example:
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight elixir"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Refresh the access token&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:ok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;refreshed_token&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="no"&gt;Oidcc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;refresh_token&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="no"&gt;MyApp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="no"&gt;OidcProvider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_secret&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  API Token Validation
&lt;/h3&gt;

&lt;p&gt;Ensuring the validity of API tokens is essential for securing your application's endpoints and protecting sensitive resources. The &lt;code&gt;oidcc&lt;/code&gt; library simplifies this task by offering robust support for API token validation through multiple methods.&lt;/p&gt;

&lt;h4&gt;
  
  
  Library Support for API Token Validation
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;oidcc&lt;/code&gt; library provides several ways to validate tokens received from clients:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;JWT Verification:&lt;/strong&gt; If your OpenID Connect provider issues access tokens as JWTs, you can perform local validation by verifying the token's signature using the provider's public keys and checking claims like issuer (&lt;code&gt;iss&lt;/code&gt;), audience (&lt;code&gt;aud&lt;/code&gt;), and expiration time (&lt;code&gt;exp&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UserInfo Endpoint:&lt;/strong&gt; Validate tokens by making a request to the UserInfo endpoint provided by the OpenID Connect issuer. A successful response confirms the token's validity and retrieves up-to-date user information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token Introspection:&lt;/strong&gt; Use the introspection endpoint to check a token's active status and retrieve associated metadata, useful for opaque tokens that cannot be validated locally.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Middleware Integration
&lt;/h4&gt;

&lt;p&gt;To streamline token validation, &lt;code&gt;oidcc&lt;/code&gt; includes middleware components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Plug Middleware:&lt;/strong&gt; In Elixir applications, integrate the provided Plug middleware into your pipeline to handle token extraction and validation for incoming requests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cowboy Middleware:&lt;/strong&gt; For Erlang applications using Cowboy, the library offers middleware that integrates token validation into your request handling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By leveraging these validation methods and middleware components, you can enhance your application's security posture.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's Next for &lt;code&gt;oidcc&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The development of &lt;code&gt;oidcc&lt;/code&gt; is an ongoing effort aimed at providing a comprehensive and secure OpenID Connect client library for the BEAM ecosystem. Looking ahead, several exciting developments and enhancements are planned to further improve the library and its utility in various applications.&lt;/p&gt;

&lt;h4&gt;
  
  
  Upcoming Features
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Completion of FAPI 2.0 Certification:&lt;/strong&gt; Work is underway to achieve full certification for the Financial-grade API (FAPI) 2.0 standards. This certification ensures that &lt;code&gt;oidcc&lt;/code&gt; meets the stringent security and interoperability requirements necessary for applications in the financial sector and other high-security environments. Special thanks to Paul Swartz for his significant contributions to this effort.&lt;br&gt;
&lt;em&gt;Update: FAPI 2.0 is implemented, pending certification.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Independent Security Review:&lt;/strong&gt; An independent security audit is being conducted to thoroughly assess &lt;code&gt;oidcc&lt;/code&gt; for potential vulnerabilities and to validate its security features. This review is made possible thanks to a collaboration with Erlang Solutions, who are providing their expertise to ensure the library's robustness.&lt;br&gt;
&lt;em&gt;Update: The review has been performed by &lt;a href="https://www.erlang-solutions.com/landings/security-audit-for-erlang-2/" rel="noopener noreferrer"&gt;SAFE&lt;/a&gt; and all findings have been remediated.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Additional Companion Libraries:&lt;/strong&gt; Plans are in place to develop companion libraries for other frameworks and tools within the BEAM ecosystem, such as integrating with the Ash Framework.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Support for Additional OpenID Protocols:&lt;/strong&gt; Enhancements are being made to support more OpenID Connect protocols, such as Single Logout (SLO) and Self-Sovereign Identity (SSI). Implementing SLO will allow users to log out of multiple applications simultaneously, improving security and user experience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enhanced Documentation and Examples:&lt;/strong&gt; Ongoing efforts to improve the documentation, provide more comprehensive examples, and create tutorials will make it easier for developers to adopt and implement &lt;code&gt;oidcc&lt;/code&gt; in their projects.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How You Can Help
&lt;/h3&gt;

&lt;p&gt;The continued success of &lt;code&gt;oidcc&lt;/code&gt; relies on the support and involvement of the community. Here are several ways you can contribute:&lt;/p&gt;

&lt;h4&gt;
  
  
  Vote for New Features
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Discussions:&lt;/strong&gt; We've posted a list of potential extensions and new standards to implement on our &lt;a href="https://github.com/erlef/oidcc/discussions" rel="noopener noreferrer"&gt;GitHub Discussions page&lt;/a&gt;. If there's a feature you'd like to see, please give it an upvote. If it's not listed, feel free to create a new discussion thread. Your input helps us prioritize developments based on community interest.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Integrate &lt;code&gt;oidcc&lt;/code&gt; into Your Projects
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Library Developers:&lt;/strong&gt; If you're developing an authentication library that could benefit from &lt;code&gt;oidcc&lt;/code&gt;, we'd be delighted to support its integration. We're happy to offer assistance to ensure a smooth implementation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Try &lt;code&gt;oidcc&lt;/code&gt; and Provide Feedback
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OpenID Connect Users:&lt;/strong&gt; If you're using OpenID Connect in your applications, try out &lt;code&gt;oidcc&lt;/code&gt; and let us know what you think. Your feedback is invaluable and helps us improve the library to better meet the community's needs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Get Involved with the EEF
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Join an EEF Working Group:&lt;/strong&gt; If you're involved in the BEAM ecosystem, consider joining a &lt;a href="https://erlef.org/working-groups" rel="noopener noreferrer"&gt;working group within the Erlang Ecosystem Foundation (EEF)&lt;/a&gt;. Your participation can make a significant impact on the community's growth and direction.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Support the EEF as a Company
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Corporate Sponsorship:&lt;/strong&gt; If your company benefits from the BEAM ecosystem, consider &lt;a href="https://erlef.org/sponsors#become-a-sponsor" rel="noopener noreferrer"&gt;sponsoring the EEF&lt;/a&gt;. Your support enables initiatives like &lt;code&gt;oidcc&lt;/code&gt; and helps foster the development of the entire ecosystem, including community growth, educational resources, and collaborative projects that benefit everyone.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>techtalks</category>
      <category>erlang</category>
      <category>elixir</category>
      <category>openid</category>
    </item>
    <item>
      <title>OpenID Connect—An Introduction</title>
      <dc:creator>Jonatan Männchen</dc:creator>
      <pubDate>Wed, 09 Oct 2024 09:07:43 +0000</pubDate>
      <link>https://dev.to/maennchen/openid-connect-an-introduction-4p4b</link>
      <guid>https://dev.to/maennchen/openid-connect-an-introduction-4p4b</guid>
      <description>&lt;h1&gt;
  
  
  Unlock the Power of OpenID Connect on the BEAM
&lt;/h1&gt;

&lt;p&gt;In today's digital world, implementing secure and efficient authentication systems is more critical than ever. OpenID Connect has emerged as a powerful protocol, offering seamless and secure login experiences for applications. I recently delved deep into this topic during my talk at Code BEAM San Francisco, titled &lt;strong&gt;"Unlock the Power of OpenID Connect on the BEAM."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For those who couldn't attend, I'm excited to share the key insights and developments from that presentation through this series of blog posts. If you're interested in exploring further, you can watch the &lt;a href="https://www.youtube.com/watch?v=4mTrqRSttyo" rel="noopener noreferrer"&gt;talk recording&lt;/a&gt; and download the &lt;a href="https://drive.google.com/file/d/1QoFH6OVZU02aQA8Z5fDM4459K34SBXGv/view?usp=sharing" rel="noopener noreferrer"&gt;slides&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/4mTrqRSttyo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Whether you're new to OpenID Connect or looking to enhance your application's security, these posts aim to provide valuable insights and practical guidance.&lt;/p&gt;




&lt;h2&gt;
  
  
  Part 1: OpenID Connect—An Introduction
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Background and Motivation
&lt;/h3&gt;

&lt;p&gt;My journey with OpenID Connect began during my time as the Tech Lead at &lt;a href="https://joshmartin.ch/" rel="noopener noreferrer"&gt;JOSHMARTIN&lt;/a&gt;, a small software consultancy based in Switzerland. Our team tackled a variety of projects that demanded robust and secure authentication systems. From developing customer and employee-facing applications for a local bank to creating a COVID-19 tracing app used by three Swiss cantons (regions similar to states), I gained firsthand experience with the challenges of implementing OpenID Connect in complex, real-world scenarios.&lt;/p&gt;

&lt;p&gt;These experiences highlighted the importance of a secure and standardized authentication protocol that could handle the complexities of modern applications while ensuring user data protection.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Is OpenID Connect?
&lt;/h3&gt;

&lt;p&gt;OpenID Connect is an open authentication protocol that provides a simple, secure, and standardized way to handle user authentication and authorization across multiple applications. Built on top of the OAuth 2.0 framework, it extends OAuth's capabilities by adding an identity layer, enabling applications not only to authorize access but also to authenticate the user's identity.&lt;/p&gt;

&lt;h4&gt;
  
  
  Key Enhancements Over OAuth 2.0:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication Layer:&lt;/strong&gt; Introduces an ID token (a JSON Web Token or JWT) to securely convey the user's identity information, allowing applications to verify who the user is and obtain basic profile information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Standardization and Interoperability:&lt;/strong&gt; Provides a well-defined set of specifications and endpoints, ensuring interoperability between identity providers and client applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User-Centric Approach:&lt;/strong&gt; Emphasizes user consent and control, allowing users to grant or deny access to their information and understand what data the application is requesting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simplicity and Usability:&lt;/strong&gt; Utilizes RESTful APIs and JSON, familiar to most developers, facilitating quicker and more secure implementation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why Use OpenID Connect?
&lt;/h3&gt;

&lt;p&gt;Implementing OpenID Connect in your applications offers numerous advantages that enhance security, improve user experience, and streamline development. Here are some compelling reasons to adopt OpenID Connect:&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Single Sign-On (SSO)
&lt;/h4&gt;

&lt;p&gt;OpenID Connect enables Single Sign-On, allowing users to authenticate once and gain access to multiple applications seamlessly. This eliminates the need for users to remember multiple sets of credentials and reduces the friction associated with logging into different services.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Enhanced Security
&lt;/h4&gt;

&lt;p&gt;OpenID Connect enhances security by leveraging trusted identity providers who implement advanced security measures. It uses digitally signed and encrypted tokens to ensure data integrity and protection against tampering. By outsourcing authentication, you minimize vulnerabilities due to misconfigurations or outdated security practices.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Standardization and Interoperability
&lt;/h4&gt;

&lt;p&gt;The protocol offers standardization and interoperability, simplifying the integration process across different platforms and programming languages. It allows you to interact with various identity providers without needing custom implementations for each one, making transitions smoother and less costly due to its standardized nature.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. User Consent and Control
&lt;/h4&gt;

&lt;p&gt;OpenID Connect emphasizes user consent and control by informing users about what information the application is requesting. It allows users to consent to or deny specific scopes or permissions, helping you comply with data protection laws by ensuring explicit user consent.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. Token-Based Authentication
&lt;/h4&gt;

&lt;p&gt;By utilizing token-based authentication, OpenID Connect reduces the need for server-side session storage, improving scalability. It enables decoupled services by authorizing API calls to different services, supporting microservices architectures. Tokens can be easily revoked and have expiration times set for better access control.&lt;/p&gt;

&lt;h4&gt;
  
  
  6. Identity Federation
&lt;/h4&gt;

&lt;p&gt;OpenID Connect supports identity federation, allowing users to authenticate using different identity providers. This simplifies integration by accepting authenticated users from various trusted sources without multiple authentication mechanisms and enhances user experience by letting users choose their preferred identity provider.&lt;/p&gt;

&lt;h4&gt;
  
  
  7. Integration with External APIs
&lt;/h4&gt;

&lt;p&gt;The protocol provides a unified authorization flow to obtain necessary tokens for accessing OpenID Connect-compliant APIs. It ensures a consistent user experience, as users authorize your application through a familiar and secure flow.&lt;/p&gt;

&lt;h4&gt;
  
  
  8. Reduced Development and Maintenance Effort
&lt;/h4&gt;

&lt;p&gt;Adopting OpenID Connect allows developers to focus on core functionality, concentrating on building application features. The availability of community support and libraries accelerates development time, and identity providers handle updates and security patches, reducing maintenance efforts.&lt;/p&gt;

&lt;h4&gt;
  
  
  9. Compliance and Trust
&lt;/h4&gt;

&lt;p&gt;Using OpenID Connect helps meet industry standards and regulatory requirements for security and data protection. It enhances your application's credibility by associating with trusted identity providers, thereby building brand reputation.&lt;/p&gt;

&lt;h4&gt;
  
  
  10. Future-Proofing Your Application
&lt;/h4&gt;

&lt;p&gt;OpenID Connect supports adaptability by embracing emerging authentication methods and security enhancements. Relying on an actively maintained standard ensures your authentication system remains relevant, providing longevity for your application.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Does OpenID Connect Work?
&lt;/h3&gt;

&lt;p&gt;OpenID Connect operates by layering an identity verification process on top of the OAuth 2.0 authorization framework. It introduces mechanisms to authenticate users and obtain basic profile information in a standardized way.&lt;/p&gt;

&lt;h4&gt;
  
  
  Key Enhancements Over OAuth 2.0
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Authentication Layer:&lt;/strong&gt; Adds an identity layer to OAuth 2.0, enabling applications to verify the user's identity using ID tokens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Introspection and Discovery:&lt;/strong&gt; Introduces introspection mechanisms that allow client applications to dynamically discover the capabilities of the identity provider.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Authentication Flows (Grant Types)
&lt;/h4&gt;

&lt;p&gt;OpenID Connect defines several authentication flows to accommodate different types of applications and use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authorization Code Flow:&lt;/strong&gt; Standard and most secure flow for web applications with a backend server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Implicit Flow:&lt;/strong&gt; For client-side applications; being phased out due to security concerns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hybrid Flow:&lt;/strong&gt; Combines elements of Authorization Code and Implicit flows for flexibility.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client Credentials Flow:&lt;/strong&gt; For server-to-server interactions without user involvement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource Owner Password Credentials Flow:&lt;/strong&gt; Generally discouraged due to security concerns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Device Authorization Grant:&lt;/strong&gt; For devices with limited input capabilities.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  The Standard Flow: Authorization Code Flow
&lt;/h4&gt;

&lt;p&gt;The Authorization Code Flow is the primary method for authenticating users in OpenID Connect. It ensures that tokens are transmitted securely and that both the client application and the user are authenticated appropriately.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3w29h6vgptquy9xxpbh5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3w29h6vgptquy9xxpbh5.png" alt="Authorization Code Flow Sequence Diagram" width="800" height="668"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flow Steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;User Redirected to Identity Provider:&lt;/strong&gt; The user initiates authentication by attempting to access a protected resource, and the application redirects them to the identity provider.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User Authenticates:&lt;/strong&gt; The identity provider presents a login interface, and the user provides their credentials.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authorization Code Issued:&lt;/strong&gt; Upon successful authentication, the identity provider redirects the user back to the application with an authorization code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token Exchange:&lt;/strong&gt; The application exchanges the authorization code for tokens by making a secure server-to-server request to the identity provider's token endpoint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token Validation:&lt;/strong&gt; The application validates the received tokens, ensuring they are authentic and have not expired.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User Session Established:&lt;/strong&gt; The user gains access to the protected resources within the application.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This flow minimizes the exposure of tokens and sensitive data, enhancing security.&lt;/p&gt;

&lt;h3&gt;
  
  
  Security in OpenID Connect
&lt;/h3&gt;

&lt;p&gt;Security is at the heart of OpenID Connect, making it a trusted protocol for handling user authentication and authorization.&lt;/p&gt;

&lt;h4&gt;
  
  
  Key Security Features:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Digitally Signed and Encrypted Tokens:&lt;/strong&gt; Ensure data integrity and protect against tampering.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State and Nonce Parameters:&lt;/strong&gt; Protect against cross-site request forgery (CSRF) and replay attacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client Authentication Methods:&lt;/strong&gt; Support for client secrets, private keys, and mutual TLS (mTLS).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Proof Key for Code Exchange (PKCE):&lt;/strong&gt; Enhances security for public clients by adding a verification step when exchanging authorization codes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JWT Secured Authorization Request (JAR) and Response Mode (JARM):&lt;/strong&gt; Encapsulate authorization requests and responses within signed JWTs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Demonstration of Proof-of-Possession (DPoP):&lt;/strong&gt; Binds tokens to a specific client instance, reducing the risk of token theft and replay attacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure HTTPS Connections:&lt;/strong&gt; Encrypts data during transmission to protect against eavesdropping or tampering.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These security measures work together to provide a comprehensive and flexible security framework, allowing developers to tailor security to their specific needs while maintaining high standards of protection.&lt;/p&gt;

</description>
      <category>openid</category>
      <category>techtalks</category>
      <category>erlang</category>
      <category>elixir</category>
    </item>
  </channel>
</rss>
