I've broken this down to a minimal case:
package MyApp; use Dancer2; use Dancer2::Plugin::DBIC; use Dancer2::Plugin::Auth::Extensible; our $VERSION = '0.1'; get '/test' => require_login sub { my $user = logged_in_user; return "Hi there, $user->{username}"; }; true;
And here's the config I'm working from:
appname: "MyApp" layout: "main" charset: "UTF-8" template: template_toolkit engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' PLUGIN_BASE: 'Template::Plugin::Pagination' session: DBIC: dsn: dbi:Pg:dbname=my_app schema_class: MyApp::Schema user: starman password: ***** plugins: DBIC: default: dsn: dbi:Pg:dbname=my_app schema_class: MyApp::Schema user: starman password: ***** options: AutoCommit: 1 AutoInactiveDestroy: 1 PrintError: 0 RaiseError: 1 Auth::Extensible: realms: users: provider: 'DBIC' users_resultset: 'User' roles_resultset: 'Role' user_roles_resultset: 'UserRole'

When I navigate to /test, I get the login page.
When I enter an invalid username and password, I get the error "LOGIN FAILED" message.
When I enter a correct username and password, the login page appears to refresh, with the URL changed - each time the return_url query string is prefixed withan extra %25%2F. Eg, after a couple of loads, it looks like this:

/login?return_url=%2F%252F%252Ftest

I guess I have 2 questions - (1) Why isn't it now displaying the /test route, and (2) Is there anyway I can set up my config so I don't have to repeat the DBIC login data.

I've been going round in circles on this all day. It's probably a stupid typo somewhere. Any ideas?


In reply to Can't get Dancer2 Auth::Extensible with DBIC working by cLive ;-)

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.