1
votes

I used JHipster to create a micro-service architecture.

I'm using JHipster Registry and JHipster UAA (OAuth2) as authentication solution.

Now I'm looking for a way to authenticate and make some API calls from a mobile application that would be developed outside of JHipster.

I tried to call UAA service from outside by calling /oauth/token ressource but it doesn't work.

Any advices?

1

1 Answers

0
votes

In a microservice architecture, you want to make requests to microservices through the gateway so it can load-balance to your microservices (including the UAA). Use the login route through the gateway (/auth/login), like the Angular and React clients do in auth-jwt.service.ts:

login(credentials): Observable<any> {
    const data = {
        username: credentials.username,
        password: credentials.password,
        rememberMe: credentials.rememberMe
    };
    return this.http.post(SERVER_API_URL + 'auth/login', data, {});
}

Note that you will also need to handle authentication via cookies, and make sure you sent the XSRF-TOKEN with each request.