# How to generate hosted login URL with JAVA

**URL:** <https://devforum.okta.com/t/how-to-generate-hosted-login-url-with-java/21203>\
**Category:** API\
**Created:** [July 8, 2022, 2:05pm UTC](https://devforum.okta.com/t/how-to-generate-hosted-login-url-with-java/21203 "2022-07-08T14:05:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![John10](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@John10](https://devforum.okta.com/u/John10)\
**Post date:** [July 8, 2022, 2:05pm UTC](https://devforum.okta.com/t/how-to-generate-hosted-login-url-with-java/21203/1 "2022-07-08T14:05:26Z")

</div>

Hello all,  
I want to generate URL to redirect user in hosted login okta interface.  
How can i do this ? With which library ? Are there any examples ?

I work with maven and tomcat, with JAVA 18.

Thank,

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [July 8, 2022, 8:55pm UTC](https://devforum.okta.com/t/how-to-generate-hosted-login-url-with-java/21203/2 "2022-07-08T20:55:56Z")

</div>

We have a [Java Spring Boot library](https://github.com/okta/okta-spring-boot) and a [sample application](https://github.com/okta/samples-java-spring/tree/master/okta-hosted-login) that shows it being used to redirect the user to Okta to log the user into the OIDC application.

---

<div class="post-metadata">

**Author:** ![John10](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@John10](https://devforum.okta.com/u/John10)\
**Post date:** [July 11, 2022, 7:12am UTC](https://devforum.okta.com/t/how-to-generate-hosted-login-url-with-java/21203/3 "2022-07-11T07:12:55Z")

</div>

Hello,  
Thanks for your reply. I already looked this doc but i not use Spring Boot.  
To execute my project i use Tomcat and zk Framework.  
So is it possible to use this Java sping boot with my project configuration ? Or is there another way to do it ?

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [August 15, 2022, 5:44pm UTC](https://devforum.okta.com/t/how-to-generate-hosted-login-url-with-java/21203/4 "2022-08-15T17:44:01Z")

</div>

I can’t say I know too much about those options, just the samples and libraries that Okta has created. IF this is for an OIDC app, then it sounds like you just need to generate the /authorize url. There may be existing frameworks for this already, but I’m not sure what your best option(s) is.

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [February 12, 2024, 9:50pm UTC](https://devforum.okta.com/t/how-to-generate-hosted-login-url-with-java/21203/5 "2024-02-12T21:50:03Z")

</div>

Closed on February 12, 2024, 9:50pm UTC


