Awesome Steve and Taylor - thanks so much :-)
AARON ROSENZWEIG / Chat 'n Bike <http://www.chatnbike.com/>
e:  aa...@chatnbike.com <mailto:aa...@chatnbike.com>  t:  (301) 956-2319        
        
        

> On May 2, 2017, at 4:10 PM, Steve Peery <spe...@me.com> 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 
> <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/ERGoogleLoginForm.html>
> https://jenkins.wocommunity.org/job/Wonder7/lastSuccessfulBuild/javadoc/er/google/components/ERGoogleLogoutLink.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 <aa...@chatnbike.com 
>> <mailto:aa...@chatnbike.com>> wrote:
>> 
>> Sounds cool Steve. Thank you :-)
>> AARON ROSENZWEIG / Chat 'n Bike <http://www.chatnbike.com/>
>> e:  aa...@chatnbike.com <mailto:aa...@chatnbike.com>  t:  (301) 956-2319     
>>         
>>      
>> 
>>> On Apr 11, 2017, at 2:53 PM, Steve Peery <spe...@me.com 
>>> <mailto:spe...@me.com>> 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/ 
>>> <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      (Webobjects-dev@lists.apple.com 
>>> <mailto:Webobjects-dev@lists.apple.com>)
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com
>>>  
>>> <https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com>
>>> 
>>> This email sent to aa...@chatnbike.com <mailto:aa...@chatnbike.com>
>> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com
> 
> This email sent to aa...@chatnbike.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to