# getToken method Null safety

1. @override

Future<OAuthToken?> getToken()
override

저장되어 있는 `OAuthToken` 반환

## Implementation

    @override
    Future<OAuthToken?> getToken() async {
      if (_currentToken != null) {
        return _currentToken;
      }

      _encryptor ??= await AESCipher.create();
      _preferences ??= await SharedPreferences.getInstance();
      var version = _preferences!.getString(versionKey);
      var jsonToken = _preferences!.getString(tokenKey);

      if (jsonToken == null || version == null) {
        _currentToken = await _migrateOldToken();
      } else {
        try {
          _currentToken =
              OAuthToken.fromJson(jsonDecode(_encryptor!.decrypt(jsonToken)));
        } catch (e) {
          await clear();
          SdkLog.e(
              'A previously saved token was deleted due to an error during decryption. Please login again.');
        }
      }
      return _currentToken;
    }