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

Method start

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

Source from the content-addressed store, hash-verified

51 }
52
53 public void start() {
54 //This needs to be at the begnning of the start method for Oauth2 to work
55 // correctly on the web. This handles the login when the Oauth2 login page
56 // redirects back tothe app
57 if (Oauth2.handleRedirect(e->{
58
59
60 if(e.getSource() instanceof AccessToken) {
61 Log.p("Logged in: " + e);
62 AccessToken token = (AccessToken)e.getSource();
63 setAccessToken(token);
64 showLoggedIn();
65 } else {
66 Log.p("Failed to login " + e.getSource());
67 showLogin();
68
69 }
70 return;
71
72 })) {
73 // The Oauth redirect was handled. Use the handleRedirect callback for control flow
74 // do not continue with rest of start() method.
75 return;
76 }
77 if(current != null){
78 current.show();
79 return;
80 }
81 showLogin();
82 }
83
84 private void doLogin() {
85

Callers

nothing calls this directly

Calls 7

handleRedirectMethod · 0.95
pMethod · 0.95
setAccessTokenMethod · 0.95
showLoggedInMethod · 0.95
showLoginMethod · 0.95
getSourceMethod · 0.65
showMethod · 0.65

Tested by

no test coverage detected