简体   繁体   中英

Redirect with HTTP_AUTHORIZATION header

I have question about redirecting with HTTP_AUTHOZIATION header.

I have two apps:

  1. Frontend Angular app

  2. Ruby on Rails app

Is it possible to create a link in Angular app that redirects to Ruby on Rails html page with HTTP_AUTHORIZATION header and then read that HTTP_AUTHORIZATION header in rails?

You cannot create a direct link with authorization headers. When you use $window.location.href the browser is making the HTTP request and not your JavaScript code.

You could use cookie via JavaScript and put your auth token there. this cookies will automatically be sent from the browser. However, you will want to review the security implications of using a cookie vs. a header.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM