MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / doLogin

Method doLogin

Samples/samples/Oauth2Login/Oauth2Login.java:84–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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());

Callers 1

showLoginMethod · 0.95

Calls 7

setBackToParentMethod · 0.95
setUseRedirectForWebMethod · 0.95
showAuthenticationMethod · 0.95
pMethod · 0.95
setAccessTokenMethod · 0.95
showLoggedInMethod · 0.95
getSourceMethod · 0.65

Tested by

no test coverage detected