Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid parameter: redirect_uri #1278

Closed
AghaSaad04 opened this issue Jun 7, 2021 · 28 comments
Closed

Invalid parameter: redirect_uri #1278

AghaSaad04 opened this issue Jun 7, 2021 · 28 comments
Assignees
Labels

Comments

@AghaSaad04
Copy link

AghaSaad04 commented Jun 7, 2021

Hi, I have cloned the master branch and trying to setup APIMan and DevPortal on VM by exposing the port of VM and accessing it from the browser of my local machine using VM-IP:PORT.

I have run the following commands so far:
mvn clean install -Pinstall-all-wildfly -DskipTests
cd tools/server-all/target/wildfly-dev-server
./bin/standalone.sh

After pointing to browser with VM-IP:Port/apimanui I am getting the following output:
image

Any leads will be helpful. Thanks

@volkflo
Copy link
Member

volkflo commented Jun 7, 2021

In Keycloak for the clients

  • apiman
  • apimanui
  • apiman-gateway-api
  • devportal

You have to enter the IP of your VM as an additional valid redirect URL like:
image

@volkflo volkflo self-assigned this Jun 7, 2021
@AghaSaad04
Copy link
Author

Hi @volkflo,
I tried accessing KeyCloak by VM-IP:Port/auth but getting the following response:

image

@volkflo
Copy link
Member

volkflo commented Jun 7, 2021

You have to access keycloak UI from inside your VM:
The easiest would be just to use the browser inside the VM then also you do not have to change the keycloak redirects.

@AghaSaad04
Copy link
Author

@volkflo I have configured the DevPortal client but I am getting CORS error when I try to login the devportal.

image

image

@volkflo
Copy link
Member

volkflo commented Jun 8, 2021

Can you please check the two things?
On the admin user verify if the view-profile and manage-account is assigned
image
On the keycloak client account set
image

The default keycloak settings are pretty secure but will maybe cause some problems with you vm setup.

@AghaSaad04
Copy link
Author

Hi @volkflo, view-profile and manage-account was not assigned to admin. I have added them and the CORS error for account has been resolved and able to login to DevPortal.

But now I am facing CORS for gateway and unable to see public APIs here.

image

image

@volkflo
Copy link
Member

volkflo commented Jun 9, 2021

Can you please check your configs again? :)
It should be xyz.abc/apiman in the screenshot I can see that it is currently xyz.abc/apimanui

@AghaSaad04
Copy link
Author

@volkflo which configs I need to check? Also, I access APIMan through VM-IP:Port/apimanui

@volkflo
Copy link
Member

volkflo commented Jun 9, 2021

image

This setting in the environment of the docker-compose.yml of the developer portal.
Replace http://localhost:8443/apiman with the IP of your http://<virtual-machine-ip>:<port>/apiman

@AghaSaad04
Copy link
Author

AghaSaad04 commented Jun 9, 2021

Oh I updated that before but changed apiman to apimanui my bad. As my APIMan was running on apimanui endpoint. Now that CORS has been resolved for the gateways.

But there are a few more CORS issue. Any configs that I need to update for them

image

@volkflo
Copy link
Member

volkflo commented Jun 10, 2021

Can you check if your apiman.properties file contains this setting:

# Set cross origin for the manager; *=any, comma separated names
apiman-manager-ui.allowed-cors-origins=*

@AghaSaad04
Copy link
Author

Hi @volkflo,

yes apiman/distro/wildfly/src/main/resources/overlay/standalone/configuration/apiman.properties file contains the following settings

# Set cross origin for the manager; *=any, comma separated names
apiman-manager-ui.allowed-cors-origins=*

However it is not present in this file apiman/distro/tomcat/src/main/resources/overlay/conf/apiman.properties

@volkflo
Copy link
Member

volkflo commented Jun 11, 2021

You can set this as well in the tomcat apiman.properties.
We are working right now on that to fix all the configuration files.

@AghaSaad04
Copy link
Author

yes, I have added that in properties, Do I need to build that again or just need to run using ./bin/standalone.sh
Also, sometimes, when I refresh the page I get this error
image

Also I am unable to add/create developers, May be they are linked to the error I have shared earlier.
image

@volkflo
Copy link
Member

volkflo commented Jun 11, 2021

You just have to restart the application server ./bin/standalone.sh to apply this setting.
New Users are currently created in keycloak.
A "Developer" is basically just the mapping between a keycloak user and one ore many apiman clients (client apps).

I am currently not sure why you getting this weird CORS error anymore.
I will try to check it and come back to you.

@volkflo
Copy link
Member

volkflo commented Jun 11, 2021

I cannot reproduce this bahavior right now.
Please make sure that apiman-manager-ui.allowed-cors-origins=* is really set.

Till the CORS problem is not fixed the Browser is not able to create a Developer.

@AghaSaad04
Copy link
Author

Below is the snapshot of apiman.properties.

image

@AghaSaad04
Copy link
Author

I have attached container logs/errors of apimanDevPortal, that may be helpful to figure out the problem.

containerLogs.txt

@volkflo
Copy link
Member

volkflo commented Jun 11, 2021

Thanks for the logs.

I was a little bit confused because I thought you are using tomcat.
But from the logs I can see that you are running on wildfly.

So the config files in the repository (like the one you send to me) are just examples.
If you have a running wildfly server the config has to be changed in there e.g.
wildfly-root-folder/standalone/configuration/apiman.properties

But the actual errors are indicating that you now have the wrong/miss-configured database for apiman right now.
The Developer Portal is currently only working if the Apiman Manger has an Elasticsearch as database running.

Please have a look at your current apiman.properties if you have uncommetted the jpa setting if you do not use them.
Otherwise it would be helpful that you provide us the full apiman.properties

The errors in the browser are currently a bit misleading because. But in the logs we can see that the request made it to the manager but there is no response because of the error in the manager.

@AghaSaad04
Copy link
Author

This is the apiman.properties currently I am using
Path of this file is /apiman/distro/wildfly/src/main/resources/overlay/standalone/configuration/apiman.properties

apiman.properties.txt

But I couldnt find apiman.properties file here. Below is the attachment
image

@volkflo
Copy link
Member

volkflo commented Jun 14, 2021

It looks like you are editing the source files in the repository and not the config file from the running application server (wildfly).
Make sure you run the following:

$ mvn clean install -Pinstall-all-wildfly
$ cd tools/server-all/target/wildfly-dev-server
$ ./bin/standalone.sh

In tools/server-all/target/wildfly-dev-server you find the apiman.properties to edit.

@AghaSaad04
Copy link
Author

I ran the following commands. I was getting some test errors, so I added skipTests parameter.

$ mvn clean install -Pinstall-all-wildfly -DskipTests
$ cd tools/server-all/target/wildfly-dev-server
$ ./bin/standalone.sh

I could find the apiman.properties on the following path. I have also attached the file.

image

apiman.properties-wildfly.txt

@AghaSaad04
Copy link
Author

@volkflo any update?

@msavy
Copy link
Member

msavy commented Jun 15, 2021

Not sure what your issue is, to be honest. We'll be cutting a release soon, so it might be worth waiting for that?

@volkflo
Copy link
Member

volkflo commented Jun 16, 2021

Make sure you have a running elasticsearch somewhere, for example:

docker run -d --name elasticsearch -p 9200:9200 -e "discovery.type=single-node" elasticsearch:7.13.2

And use the following properties file:
apiman.properties.txt

Please let us know if this is working :)

@AghaSaad04
Copy link
Author

Hi @volkflo , yes it is working properly now. Thank you so much @volkflo and @msavy for taking out time to resolve the issue.
So what I have figured out the issue was related to both properties and elasticSearch.

@volkflo
Copy link
Member

volkflo commented Jun 16, 2021

Great to hear that it is finally working for you :)
It should be easier to set up once we changed the quickstarts during the next releases.

@AghaSaad04
Copy link
Author

Yes that will be helpful. Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants