Nested parameters in data_template

I am trying to do this in a script:

camera_recording:
  sequence:
    - service: media_player.play_media
      data_template:
        media_content_id: "https://krautclan.com/api/camera_proxy_stream/camera.{{camera }}?token={{ state_attr('camera.{{ camera }}', 'access_token') }}"

which sends a URL for a certain camera along with the access token for that camera. But it does not work, the token comes out nil.

The “camera” variable is passed into the script. What is the best way to accomplish this?

Thanks!

I am calling the script from a trigger action as follows:

  action:
    - service: script.camera_recording
      data:
        camera: frontdoor
        event:  motion

Anybody…?

This should work:
{{ state_attr('camera.' + camera, 'access_token') }}

Worked like a charm! Thanks tobi-bo !!!