()
| 82 | } |
| 83 | |
| 84 | private void doLogin() { |
| 85 | |
| 86 | Oauth2.setBackToParent(false); |
| 87 | Oauth2 login = new Oauth2("https://auth.codenameone.com/auth/realms/Realm/protocol/openid-connect/auth?client_id=cn1cloudapp&scope=openid%20address&response_type=code&state=a2V5Y2xvYWs=", "cn1cloudapp", REDIRECT_URI, "openid address", |
| 88 | "https://auth.codenameone.com/auth/realms/Realm/protocol/openid-connect/token", null); |
| 89 | // Important: On the web we need to use a redirect for Oauth instead of an iframe |
| 90 | // NOTE: This needs to be accompanied by a call to Oauth2.handleRedirect() at the beginning of the start() |
| 91 | // method. |
| 92 | login.setUseRedirectForWeb(true); |
| 93 | login.showAuthentication(e -> { |
| 94 | Log.p("Logged in: " + e); |
| 95 | if(e.getSource() instanceof AccessToken) { |
| 96 | AccessToken token = (AccessToken)e.getSource(); |
| 97 | setAccessToken(token); |
| 98 | showLoggedIn(); |
| 99 | } |
| 100 | }); |
| 101 | } |
| 102 | |
| 103 | private void showLoggedIn() { |
| 104 | Form f = new Form("Logged In", BoxLayout.y()); |
no test coverage detected