Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mindsphere/mindsphere-auth-helper
Browse files Browse the repository at this point in the history
  • Loading branch information
sn0wcat committed Aug 26, 2020
2 parents 6650857 + 299086d commit a1d18bb
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

## 1.0.2 August 2020

- released to chrome store

## 1.0.1 August 2020
- vendorded all dependencies

## 1.0.0 July 2020
- initial version
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,40 @@

This chrome extension can be used to simplify the development tasks for which you need to use the [SESSION and XSRF-TOKEN](https://developer.mindsphere.io/howto/howto-local-development.html#generate-user-credentials) to access MindSphere APIs. It provides an easy way to copy the MindSphere authentication cookies to the clipboard without having to go to chrome developer tools.

## Installation

Go to <a href="https://chrome.google.com/webstore/detail/mindsphere-authentication/licndiiilobojikmhmmcgdbpmnmdeoee"><i class="fab fa-chrome"></i> chrome web store</a> and click on **add to chrome**.

Once the extension is installed: log in to your MindSphere tenant, navigate to your application and click on the extension icon to display the available application cookies. You can now click e.g. on **session** or **Xsrf** button which will copy the corresponding cookie to your clipboard.

![screenshot](images/screenshot.extension.png)

## MindSphere CLI
The cookies can be used with the tools like [curl](https://developer.mindsphere.io/howto/howto-local-development.html#curl-example), [postman](https://developer.mindsphere.io/howto/howto-local-development.html#postman-example_1) etc. (Click on the links for more examples)

```bash
#!/bin/bash

The extension works also really well with the MindSphere CLI in the [Session Cookie - XSRF-Token Configuration](https://opensource.mindsphere.io/docs/mindconnect-nodejs/cli/setting-up-the-cli.html#tab1anchor3)
curl -vv \
-G \
--cookie "SESSION=<session-copied-from=browser>;XSRF-TOKEN=<xsrf-copied-from-browser>" \
-X GET \
https://<tenantId>-<appId>-<tenantId>.<regionId>.mindsphere.io/api/assetmanagement/v3/assets
```

Use the extension to copy the cookies to the clipboard, paste them to the command line (there is bash, Windows CMD and Windows Powershell support) and start using the [MindSphere CLI](https://opensource.mindsphere.io/docs/mindconnect-nodejs/cli/index.html) right away.
## Using the cookies with MindSphere CLI

The extension works really well with the MindSphere CLI in the [Session Cookie - XSRF-Token Configuration](https://opensource.mindsphere.io/docs/mindconnect-nodejs/cli/setting-up-the-cli.html#tab1anchor3) because the **Bash**, **PS**, and **CMD** buttons already copy the cookies in the required format for MindSphere CLI.

Use the extension to copy the cookies to the clipboard, paste them to the command line and start using the [MindSphere CLI](https://opensource.mindsphere.io/docs/mindconnect-nodejs/cli/index.html) right away.

![cli](images/cookieresult.png)

## MindSphere Development Proxy
## Using the cookies with MindSphere Development Proxy

You can also use the exentsion to simplify the start of [MindSphere Development Proxy](https://opensource.mindsphere.io/docs/mindconnect-nodejs/cli/development-proxy.html) in a similar fashion. Just copy/paste the cookies to the command line and [start the development proxy](https://opensource.mindsphere.io/docs/mindconnect-nodejs/cli/development-proxy.html#tab1anchor1).
You can also use the extension to simplify the start of [MindSphere Development Proxy](https://opensource.mindsphere.io/docs/mindconnect-nodejs/cli/development-proxy.html) in a similar fashion. Just copy/paste the cookies to the command line and [start the development proxy](https://opensource.mindsphere.io/docs/mindconnect-nodejs/cli/development-proxy.html#tab1anchor1).

![cli](images/proxy-cookie.png)

This will start the development proxy with the credentials of the logged in users so that you can test the MindSphere authentication and authorization also in the local environment.

**Important: Treat the authentication cookies like your credentials and use them only in secure environments.**
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a1d18bb

Please sign in to comment.