2 Replies Latest reply on Feb 26, 2014 5:51 AM by chaluwa

    Errai UI And Google OAuth

    chaluwa

      I need to use OAuth in my Errai UI app. There's a login button in header.html (header.html is tied to @Templated AppHeader.java), which when clicked, should contact Google for authentication and then redirect back to the app's home url (index.jsp). On successful login, the login button should have a different text / label and maybe contain a dropdown.

      The issue here is how to do such a jsp-like code within header.html. I tried renaming header.html to header.jsp and updated the @Templated annotation in the AppHeader.java class, but got an error saying "there was no header.jsp for the template AppHeader".


      Considering that the UI widgets I want to change / augment after login are within header.html, how best do I approach OAuth in an Errai UI app ?

        • 1. Re: Errai UI And Google OAuth
          mbarkley

          Hi Charles,

           

          I'd recommend making a new Widget, LoginButtonContainer, which is not @Templated. Use the LoginButtonContainer to dynamically add whatever widget you desire (which could also be @Templated) depending on the login state, and finally use the LoginButtonContainer as a @DataField in your page.

           

          Cheers.

          • 2. Re: Errai UI And Google OAuth
            chaluwa

            Alright. Sounds interesting, but I am already exploring a rather different approach and it is yielding some profit. Will update this thread soon. Thanks for your help.