How to add specific org for my jwt user?

Hi. i read that " The organization that the role is assigned to can be configured using the X-Grafana-Org-Id header." in off site.How i can configure that my user will be in org “test” with orgid =2 instead of default “Main Org.”? my jwt payload

payload =  {
    "user": "test",
    "sub": "test@example.com",
    "name": "test1",
    "role": "Admin",
    "iat": int(time.time())
}

my values conf for grafana

  auth.jwt:
    enabled: true
    header_name:  X-JWT-Assertion
    username_claim: user
    email_claim: sub
    username_attribute_path: user
    email_attribute_path: sub
    auto_sign_up: true
    role_attribute_path: role
    url_login: true
    key_file: /etc/grafana/keys/grafana.key.pub
1 Like

Using URL login as you have it there, the orgId is expected to be passed in the URL. (There may be a separate reference in the docs to using X-Grafana-Org-Id - please link where you’re seeing that)

There’s an example URL on this page in the documentation where you can see orgId=1 passed in the URL string

Note that in this mode, you have to encode your JWT payload and submit it as well as a URL parameter.

Docs here:

Those docs link to a further github repo where there’s a fully worked example you can follow:

Hi thank you for you answer. I tried to use url as in doc example, but if i write orgid=1 all work but if i wrote orgId=2 or orgId=3 it did not work and wrote me “not found” ( i have org with id 2 and 3 in my grafana). Official documentation does not have separate reference it has only one sentence about how to configure " The organization that the role is assigned to can be configured using the X-Grafana-Org-Id header." About git hub they use Iframe and OAuth with keylock if i remember correctly and also they use some angular code that allow see only one page from grafana and 0 EXAMPLE how to add specific org for my JWT user. I even looked the grafana code itself to understand how to do it no change and dozens of attemtpts 0 result. Thats why i asked you )