Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Google OAuth and Get User Info

by WindyJMusic (Novice)
on Jun 17, 2022 at 20:37 UTC ( [id://11144832]=perlquestion: print w/replies, xml ) Need Help??

WindyJMusic has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I've edited this post because I left out key information that didn't help other monks give answers I was hoping for.
I'm looking to make a CGI web app that requires users to log in with Google, and returns to my web app with the user's email address and name only. I've set up credentials with Google, so I have a client ID and secret key. But now I've been trying to find the right way to make my web app.

There are SO many modules out there, and yet none of them show me how to pull the user's email address and name after I get an authorization key. I'm feeling like a complete noob and I hate it.

Can someone recommend a module to me, or perhaps even point me to some sample code that I can tailor to meet my needs? I'm so frustrated trying to find this answer.

Edit: Thanks to those who suggest Mojolicious or Dancer2, I'm hoping to stick with CGI. I have determined that what I need to do is get an Authorization Key from Google, which should then open a "Google Login" screen, which will then return to me something that will indicate to me whether or not the login was successful. What I can't find is how to pull name and email address information from Google once it's sent to me a successful login notification. What am I missing?

Thanks,
WindyJ

Replies are listed 'Best First'.
Re: Google OAuth and Get User Info
by 1nickt (Canon) on Jun 17, 2022 at 21:47 UTC

    Hi,

    I have had good success with web apps built with Dancer2 and using Dancer2::Plugin::Auth::OAuth. IIRC the Google username and other info is available in the user's session after authentication in session->{oauth}{google}{user_info}.

    Hope this helps!


    The way forward always starts with a minimal test.
      Thank for your response. I left out a key component, and I apologize ... I meant that I want to use CGI. My apologies, but thanks for the idea!
Re: Google OAuth and Get User Info
by talexb (Chancellor) on Jun 18, 2022 at 14:09 UTC

    I've used Dancer in the past, and the last full web app I wrote using Mojolicious. These frameworks are terrific, have good communities supporting them, and have all sorts of features that make things so much easier to do web development.

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11144832]
Approved by kcott
Front-paged by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-03-28 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found