I am using spring security and JWT to implement the authentication/authorization system for my mobile application and I have a couple of doubts regarding the actual design of the system. This is the authentication/authorization flow to allow users to access secured REST APIs:
The mobile application send a request to the /auth/token endpoint, along with the username and password of the user using the basic authentication scheme. The server authenticates the user returning an JWT access and refresh token.
All the subsequent requests to the protected resources represented by the endpoints /api/** are performed passing the access token, which is validated and trusted by the server. The logic to validate and trust the token is performed by a token filter executed before the spring's BasicAuthenticationFilter.
If the token is no more valid the client send the refresh token (JWT) to the /auth/refresh endpoint, which validates this token and if this is trusted returns a new access token. The /auth/refresh endpoint is publicly exposed, but it relies on the fact that the JWT signature must be valid and trusted.
I am also thinking to use OAuth, but I wanted to know if this architectural design can be used or it can be exposed to vulnerabilities or problem with scalability. I am pretty new with the authentication system and I am trying to understand the correct way to implement one without having to use OAuth.