Possible ways to retrieve GL texture id

I am currently doing

SDL_GL_BindTexture(tex, nullptr, nullptr);
GLuint textureId = 0;
glGetIntegerv(GL_TEXTURE_BINDING_2D, reinterpret_cast<GLint*>(&textureId));

when i initialize the texture.
The reason for this is that certain 3rd party libraries use the GLuint for their Image drawing functions.
Using the SDL Renderer along this works fine so far, but it is a bit annoying that i require this wrapper.

Is there a recommended way to get the GL/GLES/… id of an SDL_Texture?