Skip to content

Instantly share code, notes, and snippets.

@rswijesena
Created June 3, 2015 11:11
Show Gist options
  • Save rswijesena/e12550c480629a889ca1 to your computer and use it in GitHub Desktop.
Save rswijesena/e12550c480629a889ca1 to your computer and use it in GitHub Desktop.
Generating access tokens with NTLM. (NTLM grant type) WSO2 API manager.
Generating access tokens with NTLM. (NTLM grant type) WSO2 API manager.
You can obtain an access token by providing a valid NTLM token as an authorization grant. You need to meet the following prerequisites before using the Token API to generate a token.
You should have a windows hosted API manager 1.9.0 pack.
Invoking the Token API to generate tokens
you should have a valid consumer key and consumer secret pair. Initially, these keys must be generated through the API Store by clicking the Generate link on My Subscriptions page.
Combine the consumer key and consumer secret keys in the format consumer-key:consumer-secret and encode the combined string using base64. Encoding to base64 can be done using the URL:http://base64encode.org. In this example "SVpzSWk2SERiQjVlOFZLZFpBblVpX2ZaM2Y4YTpHbTBiSjZvV1Y4ZkM1T1FMTGxDNmpzbEFDVzhh"
you can send curl request to obtain the access token.
curl -k -d "grant_type=iwa:ntlm;windows_token=" -H "Authorization: Basic SVpzSWk2SERiQjVlOFZLZFpBblVpX2ZaM2Y4YTpHbTBiSjZvV1Y4ZkM1T1FMTGxDNmpzbEFDVzhh, Content-Type: application/x-www-form-urlencoded" https://localhost:8243/token
Furthermore, you can look at NTLM sample that provided by the pack. Its located in /samples/NTLMGrantClient. You can run that sample by following read me file's instructions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment