with-authorization-prefix.js 273 B

1234567891011
  1. /**
  2. * Prefix token for usage in the Authorization header
  3. *
  4. * @param token OAuth token or JSON Web Token
  5. */
  6. export function withAuthorizationPrefix(token) {
  7. if (token.split(/\./).length === 3) {
  8. return `bearer ${token}`;
  9. }
  10. return `token ${token}`;
  11. }