in Education by
I have a mobile app(react-native), a resource service(spring boot) and Keycloak Authenticatioin Service(Auth-Service). Client makes authentication directly with Auth-Service and gets the access token. When I do a request to the resource service, the resource service checks the access token by asking to the Auth-Service. But token obtained by the client app and iss field is http://10.0.2.2:8060/auth/realms/sau and my resource service at http://localhost:8110. Keycloak says: error="invalid_token", error_description="Invalid token issuer. Expected 'http://localhost:8060/auth/realms/sau', but was 'http://10.0.2.2:8060/auth/realms/sau'" My question is how can I make authentication in resource service behalf my client? Mobile App: export const prepareRequestBody = credentials => { const params = new URLSearchParams(); params.append('username', credentials.username); params.append('password', credentials.password); params.append('client_id', "nasilim-mobile-app"); params.append('grant_type', "password"); return params; }; export const login = credentials => { const params = prepareRequestBody(credentials); return axios.post(LOGIN, params); }; Resource-Service: application.yml keycloak: realm: sau resource: photo-service bearer-only: false auth-server-url: http://localhost:8060/auth credentials: secret: 69a3e80c-8360-42df-bcec-b6575a6949dc Note: I have checked this question and I have tried to set "X-Forwarded-For" : "http://localhost:8060/" but It didn't work Keycloak returns: { "error": "invalid_request", "error_description": "HTTPS required" } Here is a Sample Access Token that obtained by mobile client. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
The "iss" claim vary in function of the request. The variable KEYCLOAK_FRONTEND_URL can change this behavior. So try do as follow in your docker-compose file: KEYCLOAK_FRONTEND_URL: http://10.0.2.2:8060/auth

Related questions

0 votes
    I have a JHipster monolithic app with oauth2 running Keycloak locally. I don't know how exactly should ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I have a fairly similar docker-compose file to what is officially provided namely version: '3' volumes: ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    Details: We are using Keycloak authentication server with Asp.Net WebAPI. Now I need to get the Keycloak ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    I am using php oauth2 library from this github repo. PHP oauth2 library Whenever i send a refresh token, ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    I am learning about OAuth2 and OpenID Connect by experimenting with ASP.NET Core and IdentityServer4. So far ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 21, 2022 in Education by JackTerrance
0 votes
    const JwtStrategy = require('passport-jwt').Strategy, ExtractJwt = require('passport-jwt').ExtractJwt; const ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 6, 2022 in Education by JackTerrance
0 votes
    here's my problem. I access Google Analytics API via R with googleAnalyticsR. The whole thing happens in a ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    I need to create JWT token authentication, but I don't know how, could you explain me how to do ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    I have 2 large files (each about 500k lines or 85mb) containing the checksum of the file and the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    I'm trying to use babel to run my NodeJS program, which includes ES6 syntax and exports from the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 13, 2022 in Education by JackTerrance
0 votes
    I am trying to understand the usage of private const in the class. My understanding is that private const is used to make ... (void) { int const MyExample::x = 3; std::cout...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    I've seen examples that allow you to create a manipulator that inserts delimiters but none of those manipulators are sticky. That is, ... . I want to be able to do this: std::cout...
asked Apr 5, 2022 in Education by JackTerrance
0 votes
    I have a case where a VB.Net winforms app needs to play WMV files from across the network. The ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    I have a case where a VB.Net winforms app needs to play WMV files from across the network. The ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
0 votes
    I have a mystery on my hands. I am trying to learn managed C++ coming from a C# background and ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
...