Closed skiarn closed 1 year ago
Hello,
I like an working example to understand how to add Add a OAuth 2.0 proxy route to your plugin
I forked and started an example here: https://github.com/skiarn/grafana-plugin-examples/tree/example/oauth/examples/datasource-http-oauth
Main changes see plugin.json: "routes": [ { "path": "api", "url": "{{ .JsonData.defaultUrl }}/v1", "headers": [ { "name": "Authorization", "content": "Bearer {{ .SecureJsonData.apiKey }}" } ] }, { "path": "api", "url": "{{ .JsonData.defaultUrl }}/v1", "tokenAuth": { "url": "{{ .JsonData.defaultUrl }}/token", "params": { "grant_type": "password", "username": "{{ .SecureJsonData.basicAuthUser }}", "password": "{{ .SecureJsonData.basicAuthPassword }}" } } } ]
"routes": [ { "path": "api", "url": "{{ .JsonData.defaultUrl }}/v1", "headers": [ { "name": "Authorization", "content": "Bearer {{ .SecureJsonData.apiKey }}" } ] }, { "path": "api", "url": "{{ .JsonData.defaultUrl }}/v1", "tokenAuth": { "url": "{{ .JsonData.defaultUrl }}/token", "params": { "grant_type": "password", "username": "{{ .SecureJsonData.basicAuthUser }}", "password": "{{ .SecureJsonData.basicAuthPassword }}" } } } ]
How to make a working example? All I get is a 401 from remote server, how do I verify grafana managed to make an access_token exchange?
"if you need to use a different grant than client credentials, you need to implement it yourself."
Does that mean Its not possible to write a plugin? A backend plugin is required?
Hello,
I like an working example to understand how to add Add a OAuth 2.0 proxy route to your plugin
I forked and started an example here: https://github.com/skiarn/grafana-plugin-examples/tree/example/oauth/examples/datasource-http-oauth
Main changes see plugin.json:
"routes": [ { "path": "api", "url": "{{ .JsonData.defaultUrl }}/v1", "headers": [ { "name": "Authorization", "content": "Bearer {{ .SecureJsonData.apiKey }}" } ] }, { "path": "api", "url": "{{ .JsonData.defaultUrl }}/v1", "tokenAuth": { "url": "{{ .JsonData.defaultUrl }}/token", "params": { "grant_type": "password", "username": "{{ .SecureJsonData.basicAuthUser }}", "password": "{{ .SecureJsonData.basicAuthPassword }}" } } } ]
How to make a working example? All I get is a 401 from remote server, how do I verify grafana managed to make an access_token exchange?