Search in sources :

Example 1 with OAuthResponse

use of net.runelite.http.api.account.OAuthResponse in project runelite by runelite.

the class SessionManager method login.

public void login() {
    final OAuthResponse login;
    try {
        login = loginClient.login();
    } catch (IOException ex) {
        log.warn("Unable to get oauth url", ex);
        return;
    }
    // Create new session
    openSession(new AccountSession(login.getUid(), Instant.now()));
    // Navigate to login link
    LinkBrowser.browse(login.getOauthUrl());
}
Also used : IOException(java.io.IOException) OAuthResponse(net.runelite.http.api.account.OAuthResponse)

Example 2 with OAuthResponse

use of net.runelite.http.api.account.OAuthResponse in project runelite by runelite.

the class AccountService method login.

@RequestMapping("/login")
public OAuthResponse login() {
    UUID uuid = UUID.randomUUID();
    State state = new State();
    state.setUuid(uuid);
    state.setApiVersion(RuneLiteAPI.getVersion());
    OAuth20Service service = new ServiceBuilder().apiKey(oauthClientId).apiSecret(oauthClientSecret).scope(SCOPE).callback(RL_OAUTH_URL).state(gson.toJson(state)).build(GoogleApi20.instance());
    String authorizationUrl = service.getAuthorizationUrl();
    OAuthResponse lr = new OAuthResponse();
    lr.setOauthUrl(authorizationUrl);
    lr.setUid(uuid);
    return lr;
}
Also used : UUID(java.util.UUID) OAuthResponse(net.runelite.http.api.account.OAuthResponse) OAuth20Service(com.github.scribejava.core.oauth.OAuth20Service) ServiceBuilder(com.github.scribejava.core.builder.ServiceBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

OAuthResponse (net.runelite.http.api.account.OAuthResponse)2 ServiceBuilder (com.github.scribejava.core.builder.ServiceBuilder)1 OAuth20Service (com.github.scribejava.core.oauth.OAuth20Service)1 IOException (java.io.IOException)1 UUID (java.util.UUID)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1