• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Google Sign-In
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Google Sign-In


  • Subject: Re: Google Sign-In
  • From: Aaron Rosenzweig <email@hidden>
  • Date: Tue, 2 May 2017 16:12:26 -0400

Awesome Steve and Taylor - thanks so much :-)
Aaron Rosenzweig / Chat 'n Bike
e:  email@hidden  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike

On May 2, 2017, at 4:10 PM, Steve Peery <email@hidden> wrote:

Hey List,

Google Sign-In is now available as part of Wonder. 

If you have a WO application with users and email addresses, using Google Sign-In for authentication is as easy as:

1. Create a client ID: https://developers.google.com/identity/sign-in/web/devconsole-project
2. Add a ERGoogleLoginForm to your login page:  <wo:ERGoogleLoginForm error = "$errorMessage" />
3. Add a login direct action:
public WOActionResults googleLoginAction() {
String token = request().stringFormValueForKey("authToken");
Session session = (Session) session();
User user = User.validateForGoogleToken(session.defaultEditingContext(), token);
if (user != null) {
session.setUser(user);
return loggedInPage(session);
}
Main result = pageWithName(Main.class);
result.setErrorMessage("Invalid Google User");
return result;
}
4. Add a User validation method:
public static User validateForGoogleToken(EOEditingContext editingContext, String googleToken) {
if (googleToken == null) {
throw new NullArgumentException("googleToken may not be null");
}
try {
Payload payload = ERGoogleSignInUtilities.payloadFromToken(googleToken);
return User.fetchRequiredUser(editingContext, EMAIL.is(payload.getEmail()));
}
catch (Exception e) {
return null;
}
}
5. Add a ERGoogleLogoutLink to your logged in page: <wo: ERGoogleLogoutLink  action = “$logout" />

That is it!

Documentation is here: 
https://jenkins.wocommunity.org/job/Wonder7/lastSuccessfulBuild/javadoc/er/google/components/ERGoogleLoginForm.html
https://jenkins.wocommunity.org/job/Wonder7/lastSuccessfulBuild/javadoc/er/google/components/ERGoogleLogoutLink.html

Special thanks to Taylor Hadden who actually wrote the code.

Steve

On Apr 11, 2017, at 8:59 PM, Aaron Rosenzweig <email@hidden> wrote:

Sounds cool Steve. Thank you :-)
Aaron Rosenzweig / Chat 'n Bike
e:  email@hidden  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike

On Apr 11, 2017, at 2:53 PM, Steve Peery <email@hidden> wrote:

Hi List,

I have a Framework with a couple of components that make integrating Google Sign-In (https://developers.google.com/identity/sign-in/web/) into a Wonder Application quick and easy.

Would it be helpful to others to have this added to Wonder?

Steve Peery
Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Google Sign-In (From: Steve Peery <email@hidden>)

  • Prev by Date: Re: Google Sign-In
  • Next by Date: wocommunity.repo ??
  • Previous by thread: Re: Google Sign-In
  • Next by thread: wocommunity.repo ??
  • Index(es):
    • Date
    • Thread