What's the best way to log in a user and navigate to a record?

Do I create a web service or a javascript/jquery to be used when a user clicks on a button in the First web application, the web service or scripting program will open a new browser tab,  authenticate the users to a Second web application program and navigate to a record, which the url will be provided from the First web application?

User clicks a button in the First web application.  It would then activate either a web service or script program that authenticate them.  So, is it safe to pass the user log in credential when calling?  

The reason this program is needed because if the First web application just navigate to that record's url in the Second web application, it would land the users at the Log In page and once users logged in, they would just be at the default page and not at the url where the record detail page they want.  

thank you.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
you pretty much have to do it that way since the 2 web applications don't share information between each other.
ste5anSenior DeveloperCommented:
I would use one authentication service which hands out tokens. So your App1 can handover this token to App2. App2 needs to server-side validate the token, but that would be it.
lapuccaAuthor Commented:
Do it which way?  Web service possibility or has to be javascript?  Any example on the internet?

"authentication service", is that an API service that web app2 has to provide?  It currently doesn't have an API that does that.  Or is there something built-in?

Thank you.
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
>I create a web service or a javascript/jquery

I would say both David and ste5an are pointing you in the direction of using a webservice.

The only way you could use javascript/jquery is if you used it for an ajax call to your webservice / authentication page.  But you couldn't use javascript for the actual authentication because it runs on the client's browser and you would have to expose credentials.

Wether you post authentication from a form to an authentication page or use javascript/jquery to make an ajax call to the authentication service, the end result is you need a webservice / authentication page to handle the server side processing that will talk to the database, look up the user/pass and pass on some type of authentication token.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.