The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Web::Solid::Auth - A Perl Solid Web Client


    # On the command line

    # Set your default webid
    export SOLID_WEBID=

    # Authentication to a pod authenticate

    # Get the http headers for a authenticated request headers GET

    # Act like a curl command and fetch authenticated content curl -X GET

    # Add some data curl -X POST \
            -H "Content-Type: text/plain" \
            -d "abc" \
    # Add a file curl -X PUT \
            -H "Content-Type: application/ld+json" \
            -d "@myfile.jsonld" \

    # Set a solid base url

    # List all resources on some Pod path list /public/

    # Get some data get /inbox/

    # Post some data post /inbox/ myfile.jsonld 

    # Put some data put /public/myfile.txt myfile.txt 

    # Create a folder put /public/mytestfolder/

    # Delete some data delete /public/myfile.txt

    # Mirror a resource, container or tree mirror /public/ ./my_copy

    # Upload a directory to the pod
    #  Add the -x option to do it for real (only a test without this option) -r upload /data/my_copy /public/

    # Clean all files in a container
    #  Add the -x option to do it for real (only a test without this option) --keep clean /demo/

    # Clean a complete container 
    #  Add the -x option to do it for real (only a test without this option) -r clean /demo/

    # In a perl program
    use Web::Solid::Auth;
    use Web::Solid::Auth::Listener;

    # Create a new authenticator for a pod
    my $auth = Web::Solid::Auth->new(webid => $webid);

    # Or tune a listerner
    my $auth = Web::Solid::Auth->new(
          webid     => $webid ,
          listener => Web::Solid::Auth::Listener->new(
                scheme => 'https'
                host   => ''
                port   => '443' ,
                path   => '/mycallback'

    # Or, in case you have your own callback server
    my $auth = Web::Solid::Auth->new(
          webid         => $webid,
          redirect_uri => ''

    # Generate a url for the user to authenticate
    my $auth_url = $auth->make_authorization_request;

    # Listen for the oauth server to return tokens
    # the built-in listener for feedback from the openid provider
    # Check the code of Web::Solid::Auth::Listener how to
    # do this inside your own Plack application


    # If you already have access_tokens from previous step
    if ($auth->has_access_token) {
        # Fetch the Authentication and DPoP HTTP headers for a
        # request to an authorized resource
        my $headers = $auth->make_authentication_headers($resource_url,$http_method); you curl..lwp::agent..or what ever with the headers


See the file in the distribution.


This is a Solid-OIDC implementation of a connection class for the Solid server. Use the bin/ command as a command line implementation. Check out the example directory for a demo web application.



The Solid Webid to authenticate.


The location of the cache directory with connection parameters.



Returns a true value when a cache contains an access token for the webid.


Clear the cache directory.


Return an authorization URL that the use should open to authenticate this application.


When on the redirect url you get a code from the authentication server you can use this method to get an access_token for the code.


Create a small built-in web server to listen for token responses from the authentication server.


Return the cached access_token.



This was very much inspired by the Python solid-flask code by Rai at, and Jeff Zucker's <> Solid-Shell at


This software is copyright (c) 2021 by Patrick Hochstenbach.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.