MCPcopy Create free account
hub / github.com/LibreVR/Revive / LoadToken

Method LoadToken

ReviveOverlay/oculusoauthtokencontroller.cpp:63–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63bool COculusOauthTokenController::LoadToken()
64{
65 QSqlQuery query = QSqlQuery( m_sqliteDb );
66 if( !query.exec( "SELECT value FROM 'Objects' WHERE hashkey = '__OAF_OFFLINE_DATA_KEY__'" ))
67 return false;
68
69 query.first();
70 QByteArray offlineDataByteArray = query.value(0).toByteArray();
71 qsizetype token_start_index = offlineDataByteArray.indexOf("last_valid_auth_token") + 31;
72 if (token_start_index == -1)
73 return false;
74
75 qsizetype token_stop_index = -1;
76 if(offlineDataByteArray.contains("last_valid_fb_access_token"))
77 token_stop_index = offlineDataByteArray.indexOf("last_valid_fb_access_token") - 4;
78
79 if (offlineDataByteArray.mid(token_start_index).contains("last_valid_auth_token_type"))
80 /*'last_valid_auth_token_type' matches 'last_valid_auth_token' in indexOf, so
81 search after the index of 'last_valid_auth_token' */
82 token_stop_index = offlineDataByteArray.mid(token_start_index).indexOf("last_valid_auth_token_type") - 4;
83
84 if (token_stop_index == -1)
85 return false;
86
87 m_strAccessToken = QString::fromStdString(offlineDataByteArray.mid(token_start_index, token_stop_index).toStdString());
88 TokenChanged();
89 return true;
90}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected