Net::BrowserID::Verify - Verify BrowserID assertions.
version 0.001
# Procedural API use Net::BrowserID::Verify qw(verifyRemotely); my $data = verifyRemotely('assertion', 'audience'); # OO API use Net::BrowserID::Verify; my $verifier = Net::BrowserID::Verify->new({ type => q{remote}, audience => q{http://localhost}, }); my $data = $verifier->verify('assertion');
Once you have $data from the verifier, you can then check if the status was okay.
if ( $data->{status} eq 'okay' ) { # read $data->{email} to set up/login your user print $data->{email}; } else { # something went wrong with the verification or the request print $data->{reason}; }
The assertion format you receive when using Persona/BrowserID needs to be sent from your browser to the server and verified there. This library helps you verify that the assertion is correct.
The data returned by verifyRemotely(), verifyLocally() or $verifier->verify() contains the following fields:
verifyRemotely()
verifyLocally()
$verifier->verify()
status
The status of the verification. Either 'okay' or 'failure'.
email
The email address which has been verified.
Provided only when status is 'okay'.
issuer
The issuer/identity provider, which should be either the domain of the email address being verified, or the fallback IdP.
expires
The expiry (in ms from epoch). e.g. 1354217396705.
audience
The audience you passed to the verifier.
reason
Gives the reason why something went wrong.
Only provided if the status is 'failure'.
Andrew Chilton "chilts@mozilla.com"
Copyright (c) 2013 Mozilla.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
To install Net::BrowserID::Verify, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::BrowserID::Verify
CPAN shell
perl -MCPAN -e shell install Net::BrowserID::Verify
For more information on module installation, please visit the detailed CPAN module installation guide.